[issue7900] posix.getgroups() failure on Mac OS X

2010-06-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Reposting from python-dev. See "os.getgroups() on MacOS X" <http://mail.python.org/pipermail/python-dev/2010-June/100960.html>. """ On Wed, Jun 23, 2010 at 2:08 AM, Ronald Oussoren wrote: .. >> >>> * [Ron

[issue9063] TZ examples in datetime.rst are incorrect

2010-06-23 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : With python started at the root of the source tree and TZ=US/Eastern in the environment, >>> exec(open('Doc/includes/tzinfo-examples.py').read()) >>> import os >>> os.environ['TZ'] 'US/Eastern'

[issue9063] TZ examples in datetime.rst are incorrect

2010-06-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The result given when Eastern tzinfo object is used is clearly wrong. The timezone shift should not change the actual time, but >>> x == x.astimezone(Eastern) False while >>> x == x.asti

[issue9063] TZ examples in datetime.rst are incorrect

2010-06-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Let's establish what is the correct wall clock sequence around EDT to EST transition: >>> import time >>> def print_time(s): ...tt = time.localtime(s) ...print(time.strftime('%c %z %Z', tt)) x = datetime(2010

[issue9048] no OS X buildbots in the stable list

2010-06-23 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- assignee: -> ronaldoussoren components: +Macintosh -None ___ Python tracker <http://bugs.python.org/issue9048> ___ ___ Py

[issue9051] Cannot pickle timezone instances

2010-06-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Committed in r82184. Leaving the issue open pending a more thorough review of pickling in datetime module. -- keywords: -easy, patch priority: normal -> low ___ Python tracker <http://bugs.pyth

[issue9009] Improve quality of Python/dtoa.c

2010-06-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > - ignore the rounding mode completely, always doing round-half-to-even. +1 -- ___ Python tracker <http://bugs.python.org/iss

[issue9070] Timestamps are rounded differently in py3k and trunk

2010-06-24 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : In the trunk: >>> datetime.utcfromtimestamp(0.994) datetime.datetime(1970, 1, 1, 0, 0, 1) In py3k: >>> datetime.utcfromtimestamp(0.994) datetime.datetime(1970, 1, 1, 0, 0, 0, 99) See issue1478429 - it appears th

[issue9070] Timestamps are rounded differently in py3k and trunk

2010-06-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: My mistake. I had datetime.py from pypy in the directory from which I ran the trunk python. The problem is also in the latest sandbox version of datetime.py, but this is not yet part of cpython proper. Refiled as pypy bug at http://codespeak.net

[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

2010-06-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Similar problem affects fromtimestamp() constructors: >>> datetime.fromtimestamp(0.0078125)-datetime.fromtimestamp(0) datetime.timedelta(0, 0, 7813) >>> datetime.utcfromtimestamp(0.0078125)-datetime.utcfromtimestamp(0) datetime.ti

[issue6608] asctime does not check its input

2010-06-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I've just noticed that time_strftime already has the range checks for tm structure fields. These checks can be separated in a function and shared with asctime. Marking this as "easy". See also issue897625. -- keyword

[issue9079] Make gettimeofday available in datetime module

2010-06-24 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Attached patch moves cross-platform logic of obtaining current time to _time.c which is shared between time and datetime modules. This simplifies both modules and reduces the datetime module dependency on the time module. -- assignee

[issue9079] Make gettimeofday available in datetime module

2010-06-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The new patch, issue9079.diff exposes gettimeofday as time.gettimeofday() returning (sec, usec) pair. -- Added file: http://bugs.python.org/file17767/issue9079.diff ___ Python tracker <http://bugs.python.

[issue9079] Make gettimeofday available in datetime module

2010-06-24 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17766/gettimeofday.diff ___ Python tracker <http://bugs.python.org/issue9079> ___ ___ Python-bug

[issue9079] Make gettimeofday available in time module

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Mark, I am reassigning this to you for commit review. I am changing the title to reflect the visible part of the change. The datetime module gains direct access to system gettimeofday at the C level while time module grows time.gettimeofday() Python

[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: >> The timedelta(seconds=0.6112295) example is handled correctly > No, it's not! It's being rounded *up* where it should be > being rounded *down*. Let me try to reformulate the issue. When use is entering 0.6112295, she

[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Deprecating the feature for 3.x is certainly an option. > May be a little drastic though. How drastic would be to stop subclassing datetime from date in 3.2? After all, we don't subclass flo

[issue1578643] various datetime methods fail in restricted mode

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: See issue9079. -- dependencies: +Make gettimeofday available in time module ___ Python tracker <http://bugs.python.org/issue1578

[issue5288] tzinfo objects with sub-minute offsets are not supported (e.g. UTC+05:53:28)

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This proved to require a lot of changes to C implementation because most of timezone arithmetics is done using integer operations with offset in minutes. It is easy, however to do this in pure python implementation which can be found at http

[issue9051] Improve pickle format for aware datetime instances

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The datetime module provides compact pickled representation for date, datetime, time and timedelta instances: type: size date: 34 datetime: 44 time: 36 timedelta: 37 On the other hand, current pickle size for timezone is 64 and the size of an aware

[issue9079] Make gettimeofday available in time module

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would very much appreciate Tim's input on datetime issues. This particular issue is fairly minor, but Tim's expertise will be invaluable for anything timezone related. I do appreciate the incredible amount of brainpower that went into the

[issue8947] Provide as_integer_ratio() method to Decimal

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Raymond, conversion to Fraction does not really help in my use case of supporting timedelta * Decimal by duck typing. I can think of many other use cases where it will be helpful to accept either float or decimal without loss of precision. Is there

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Here is a similar issue which may be easier to fix: >>> def f(a, b=None, *, c=None, d=None): ...pass >>> f(1,2,3) Traceback (most recent call last): File "", line 1, in TypeError: f() takes at most 4 arguments (3 g

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- assignee: belopolsky -> ___ Python tracker <http://bugs.python.org/issue2516> ___ ___ Python-bugs-list mailing list Un

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- ___ Python tracker <http://bugs.python.org/issue2516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- ___ Python tracker <http://bugs.python.org/issue2516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- ___ Python tracker <http://bugs.python.org/issue2516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- ___ Python tracker <http://bugs.python.org/issue2516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue9051] Improve pickle format for aware datetime instances

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a python prototype implementing interned UTC instance pickling. The patch is against sandbox revision r82218 of datetime.py. Note that the pickling protocol requires that an instance or factory function is defined at the module level

[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Adding tim_one to the nosy list. Tim, It would be great if you could shed some light on the history behind pure python implementation. Why was it developed in the first place? What was the reason not to ship it with python? Thanks. -- nosy

[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Tim, thanks for your prompt reply. What would be your opinion on adding datetime.py to the main python tree today? There is momentum behind several features to be added to datetime module and having easily accessible prototype would give similar

[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > For io, we find this quite manageable indeed, although it is quite more > complex and quirkier than datetime. I don't understand how something being "more complex and quirkier," can make it more "manageable." While

[issue4775] Incorrect documentation - UTC time

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Python implementation of time functions certainly has nothing to do with UT1, which is the time as measured by (modern) sun dials. The correct name would be POSIX time. As explained in POSIX rationale, """ Coordinated Universal Time

[issue4775] Incorrect documentation - UTC time

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: """ The gmtime() function shall convert the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as Coordinated Universal Time (UTC). """ In a technical sense, this is correct. The resul

[issue9024] PyDateTime_IMPORT macro incorrectly marked up

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Committed in r82236 - r82239. -- nosy: +belopolsky resolution: -> accepted stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.o

[issue1520662] support all of strftime(3)

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: time.strftime does support all of the platform strftime(3) format codes. -- assignee: -> belopolsky nosy: +belopolsky resolution: -> out of date stage: -> committed/rejected status: open -

[issue5109] array.array constructor very slow when passed an array object.

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- assignee: -> belopolsky nosy: +belopolsky, mark.dickinson -Alexander.Belopolsky ___ Python tracker <http://bugs.python.org/iss

[issue5109] array.array constructor very slow when passed an array object.

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- stage: -> patch review ___ Python tracker <http://bugs.python.org/issue5109> ___ ___ Python-bugs-list mailing list Un

[issue762963] timemodule.c: Python loses current timezone

2010-06-25 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +belopolsky ___ Python tracker <http://bugs.python.org/issue762963> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9024] PyDateTime_IMPORT macro incorrectly marked up

2010-06-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Should also add :cvar: tag to PyDateTimeAPI. http://docs.python.org/documenting/markup.html#information-units Thanks, Ezio. -- assignee: d...@python -> belopolsky status: closed -> open ___ Python t

[issue3385] cPickle to pickle conversion in py3k missing methods

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Do I understand correctly that the issue is that python Pickler class has dispatch attribute but C Pickler does not? The add_dispatch_check-0.patch patch does not seem to add class attribute, it adds an instance attribute instead. I also noticed that

[issue762963] timemodule.c: Python loses current timezone

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I agree with Martin. A proper fix would be to use tm_gmtoff explicitly where available and carry it in time.struct_time. See issue1647654 and issue4086. Interestingly, the issue does not show up on OSX, which being a BSD derivative does have

[issue762963] timemodule.c: Python loses current timezone

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Another related issue is issue1667546. -- ___ Python tracker <http://bugs.python.org/issue762963> ___ ___ Python-bug

[issue9024] PyDateTime_IMPORT macro incorrectly marked up

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Committed in r82251. Thanks for the patch, Tim. -- status: open -> closed ___ Python tracker <http://bugs.python.org/iss

[issue7989] Add pure Python implementation of datetime module to CPython

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I see. I misunderstood AP's "although" as "however", but he probably meant "even though" or "in spite the fact that." Antoine, can I count you as "+1"? In any case, my threshold for moving thi

[issue655802] cPickle not always same as pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: What is the status of this? issue1536 is an open documentation issue. Is this similarly a documentation enhancement request or there is a case when pickle and CPickle produce different and incompatible serializations? -- nosy: +belopolsky

[issue9089] PyNumber_Int is still mentioned in number protocol docs

2010-06-26 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : See http://docs.python.org/dev/py3k/c-api/number.html#PyNumber_Int I also noticed some left-over references to intobject in the comments in the py3k tree: Include/longobject.h:61:/* For use by intobject.c only */ Modules/xxmodule.c:13: intobject.h

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: If I disable _pickle, I get a more meaningful trace: File "Tools/pybench/pybench.py", line 954, in PyBenchCmdline() File "/Users/sasha/Work/python-svn/py3k-commit/Tools/pybench/CommandLine.py", line 349, in __init__ rc

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The bytes/string issu was a red herring: with pickle.load(open('27.bench', 'b')), I get the same stack trace as from command line pybench invocation. >>> pickle.load(open('27.bench', 'rb')) Traceba

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Hmm. It looks like another pickle vs. _pickle issue. Attached patch is a result of 2to3 applied to Tools/pybench (and a minor manual fix for pickle import) with _pickle import disabled. With the patch applied, $ ./python Tools/pybench/pybench.py

[issue9093] Tools/README is out of date

2010-06-27 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Here is the list of subdirectories in Tools. Here is the diff between directory listing and readme ('-' means no readme entry, '+' - no tool): -buildbot -ccbench +audiopy +compiler faqwiz -framer freeze gdb i18n -iobench -

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I have found issue1634499 which deals with running pybench. I suggest that we reopen that issue and move discussion of issue5180.diff there. I really like the idea to keep single source for 2.x and 3.x pybench, but we need to add some machinery to run

[issue9094] Make python-m pickletools do something useful

2010-06-27 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Attached patch makes python -m pickletools print symbolic disassembly of a pickle to stdout. If the idea is well received, I will add help option, usage string and possibly -o option to redirect output to a file. I am not sure that current &quo

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like I was able to get to the root of the problem. I am attaching two files that demonstrate the issue: ==> pickle-bug.py <== import pickle import sys class Bug: pass bug = Bug() f = open(sys.argv[1], 'w') pickle.Pickl

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file17785/unpickle-bug.py ___ Python tracker <http://bugs.python.org/issue5180> ___ ___ Python-bug

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: As promised, here is the fix (issue5180-pickle.diff) for the "unpickle-bug.py" issue. Unfortunately, it looks like more bugs remain. 27.bench is still not loadable. -- stage: -> unit test needed Added file: http://bugs.python.

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The remaining bug is a bit harder. If you try to run unpickle-bug-2.py on the same pickle, you get $ python3 unpickle-bug-2.py /tmp/bug.pkl <__main__.Bug object at 0x1006a8f40> Traceback (most recent call last): File "unpickle-bug-2.py&q

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch which makes python3 read 27.bench without errors. I think this should be applied while a complete solution for unpickling old style class instances from text mode (protocol = 0) pickles is found. -- Added file: http

[issue9102] pybench: Cannot compare 2.x and 3.x benchmarks

2010-06-28 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : There are several issues that prevent $ python3 Tools/pybench/pybench.py -s 27.bench -c 32.bench from working. 1. There is a bug in _pickle that prevents 2.x pickles that contain classic class instances from loading in 3.x. This is addressed in

[issue9102] pybench: Cannot compare 2.x and 3.x benchmarks

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- dependencies: +3.1 cannot unpickle 2.7-created pickle ___ Python tracker <http://bugs.python.org/issue9102> ___ ___ Python-bug

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : This is probably one example of many where pickling is only tested with _pickle module if it is available rather than separately with C and Python implementation. I am attaching a patch which implements one possible testing strategy. If this is

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +benjamin.peterson ___ Python tracker <http://bugs.python.org/issue9104> ___ ___ Python-bugs-list mailing list Unsub

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch which focuses on fixing _pickle behavior. I opened a separate issue9102 to deal with pybench specific problems. Marc-Andre, I am reassigning this issue to myself and assigning issue9102 to you. I hope you don't mind

[issue9105] pickle security note should be more prominent

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: See also issue8855. I believe Anatoly refers to http://docs.python.org/py3k/library/pickle.html I agree, the warning can be moved up so that it is visible on the first page in typical rendering. Note that there is also http://docs.python.org/py3k

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17781/issue5180.diff ___ Python tracker <http://bugs.python.org/issue5180> ___ ___ Python-bug

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17788/issue5180-fix.diff ___ Python tracker <http://bugs.python.org/issue5180> ___ ___ Pytho

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- stage: unit test needed -> patch review ___ Python tracker <http://bugs.python.org/issue5180> ___ ___ Python-bugs-list mai

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: In the new patch, issue9104.diff, I factored out import machinery into test.support.import_module_implementations and added it to a a couple of other test modules. I did not attempt to improve all pickle tests. The availability of

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17793/issue9104.diff ___ Python tracker <http://bugs.python.org/issue9104> ___ ___ Python-bug

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file17794/issue9104.diff ___ Python tracker <http://bugs.python.org/issue9104> ___ ___ Python-bug

[issue9094] Make python-m pickletools do something useful

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Well, assuming you want to make it useful, I'd make that > behaviour depend on a command-line option, .. OK, Antoine, you asked for it. :-) issue9094.diff -- Added file: http://bugs.python.org/file17797/iss

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Mon, Jun 28, 2010 at 7:32 PM, Antoine Pitrou wrote: >> My patch attempts to emulate 2.x PyInstance_NewRaw with a call to >> tp_alloc. > > This is certainly the wrong thing to do. You could at least try > PyBaseObject_Type.tp_new

[issue1581183] pickle protocol 2 failure on int subclass

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I reproduced the problem in py3k (both protocol 2 and 3). See issue1581183-test-py3k.py attached. -- nosy: +alexandre.vassalotti, belopolsky versions: +Python 3.2 Added file: http://bugs.python.org/file17798/issue1581183-test-py3k.py

[issue960821] Add an updating load function in pickle

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This functionality already exists. """ If a string is returned [from __reduce__() method], the string should be interpreted as the name of a global variable. It should be the object’s local name relative to its module; the pickle modu

[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: At least part of the problem has nothing to do with subclassing from int and instead is related to pickling objects with circular references. I am attaching a patch that demonstrates the problem. In issue1581183-test.diff, I modified memoize so that

[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17800/issue1581183-test.diff ___ Python tracker <http://bugs.python.org/issue1581183> ___ ___

[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file17801/issue1581183-test.diff ___ Python tracker <http://bugs.python.org/issue1581183> ___ ___

[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Upon further investigation, I conclude that the problem is in the user code. I am attaching int_subclass_pickle_problem_fixed.py which fixes the user code as follows: def __getnewargs__(self): -return (int(self), self.an_enum

[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I believe that *args and **kwargs are now also syntactically > accepted in a class definition. Indeed: >>> class a: pass >>> class b: pass >>> bases = (a, b) >>> class c(*bases): pass >>> kwds = {

[issue6827] deepcopy erroneously doesn't call __setstate__ if __getstate__ returns empty dict

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I see the following under <http://docs.python.org/dev/py3k/library/pickle.html#pickling-class-instances>: Note If __getstate__() returns a false value, the __setstate__() method will not be called. That was added in r62216 and highlighted in

[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The production looks right to me, but I think it should be broken in two or more lines. Since it is rendered pre-formatted, long line results in a horizontal scroll bar unless the browser window is extremely wide

[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Empty sets are pickled as set([]). The pickle contains serialization of an empty list that is passed to set constructor during unpickling: >>> dis(dumps(set())) 0: \x80 PROTO 3 2: cGLOBAL 'builtins set' 16

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > An explicit dictionary to map the Python and C implementations may be a > better approach. Do you mean a global optimized_module = {'pickle': '_pickle'} in test/support.py? I don't think I like this idea. Even w

[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It is both space and time optimization. Fred was a proponent of small pickle sizes in the past, so I am adding him to the nosy list. I am not too keen on this to happen, though. It just seemed more natural to me not to create an empty list to

[issue9079] Make gettimeofday available in time module

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The original patch, gettimeofday.diff was just refactoring. I unlinked it to keep the file list clean, but it is still available: http://bugs.python.org/file17766/gettimeofday.diff I decided to expose time.gettimeofday() in the same patch mostly in

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The case in msg76028 are probably not pointing to a bug. If subclass' __init__ passes its args to the base class __init__ (as it probably should), pickling works: class E(Exception): """Extension with values, init called w

[issue6477] Pickling of NoneType raises PicklingError

2010-06-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Ellipsis and NotImplemented are different from None because they are not pickleable themselves. The None situation is more similar to that of say module level functions: >>> def f(): pass ... >>> dumps(f) # works b'\x80

[issue7830] Flatten nested functools.partial

2010-06-30 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch, issue7830.diff, that takes an ultra-concervative approach: partials are only flattened if both outer and inner are of exact functools.partial type and the inner partial does not have __dict__. -- assignee: -> belopol

[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > We don't have to introduce a new (and backwards incompatible) > opcode for every possible container type. I would draw the line at containers that have literal syntax (and necessarily have dedicated .pyc opcode). This begs a question, h

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-30 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would like to commit this as written. If a better mechanism for associating native implementation with a pure python module is found, it can easily be added in the future. Any objections? The patch only adds more test cases, no code is changed

[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-30 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- assignee: -> belopolsky resolution: -> accepted stage: patch review -> commit review ___ Python tracker <http://bugs.python.o

[issue9132] Documentation for comparing dictionaries is out of date

2010-06-30 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Reference to "sorted (key, value) lists" is a bit misleading as well. Dicts' equality is defined even if key or values are not orderable. -- nosy: +belopolsky ___ Python tracker <http

[issue9118] help() on a property descriptor launches interactive help

2010-06-30 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This is simply because X.foo.fset is None and help(None) is the same as help(). Now, I think help(None) should print help on None object rather than start interactive help. Please consider attached patch. -- keywords: +patch nosy: +belopolsky

[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > You can make the dictionary values as lists for the 'blocked' > argument for import_fresh_module(). That would work [for io]. I don't understand how having multiple modules in the blocked list will help in io case. io.py will s

[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Thanks a lot for the review. Please see my replies below. On Thu, Jul 1, 2010 at 12:09 PM, Antoine Pitrou wrote: .. > - I find the _cmp() and __cmp() indirection poor style in 3.x, > especially when you simply end up comparing self._getstate

[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Thu, Jul 1, 2010 at 12:18 PM, Antoine Pitrou wrote: .. >> I don't understand how having multiple modules in the blocked list >> will help in io case.  io.py will simply not work if _io is blocked. > > Which you avoid by giving a

[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > R. David Murray added the comment: > > If they abuse the _ methods and complain that the C version doesn't > work, we just say "we *told* you not to do that".  It is not the Python > philosophy to try to protect users fro

[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-02 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > - I find the _cmp() and __cmp() indirection poor style in 3.x, > especially when you simply end up comparing self._getstate() and > other._getstate() (it is also suboptimal because it can do more > comparisons than needed) The best I could

[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-02 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I am talking specifically about this kind of assert: > >assert 1 <= month <= 12, 'month must be in 1..12' > > I think it should be replaced with: > >if month < 1 or month > 12: >raise ValueE

[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-02 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > If they abuse the _ methods and complain that the C version doesn't > work, we just say "we *told* you not to do that". It is not the Python > philosophy to try to protect users from mistakes that they willfully > make

<    4   5   6   7   8   9   10   11   12   13   >