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
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
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
Changes by Alexander Belopolsky :
Added file: http://bugs.python.org/file17785/unpickle-bug.py
___
Python tracker
<http://bugs.python.org/issue5180>
___
___
Python-bug
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.
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
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
New submission from Alexander Myodov :
I am using Python 2.6.5/win32, and working with multiprocessing module, doing
that with Python interpreter embedded using Cython (if that may be related to
the problem).
While creating a subprocess and a Pipe to communicate with it, I've go
Alexander Myodov added the comment:
Sorry for formatting above, a copypaste issue.
The lines 202-204:
win32.SetNamedPipeHandleState(
h2, win32.PIPE_READMODE_MESSAGE, None, None
)
The change that fixes the problem (at least for me):
try
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
Changes by Alexander Belopolsky :
--
dependencies: +3.1 cannot unpickle 2.7-created pickle
___
Python tracker
<http://bugs.python.org/issue9102>
___
___
Python-bug
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
Changes by Alexander Belopolsky :
--
nosy: +benjamin.peterson
___
Python tracker
<http://bugs.python.org/issue9104>
___
___
Python-bugs-list mailing list
Unsub
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
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
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17781/issue5180.diff
___
Python tracker
<http://bugs.python.org/issue5180>
___
___
Python-bug
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17788/issue5180-fix.diff
___
Python tracker
<http://bugs.python.org/issue5180>
___
___
Pytho
Changes by Alexander Belopolsky :
--
stage: unit test needed -> patch review
___
Python tracker
<http://bugs.python.org/issue5180>
___
___
Python-bugs-list mai
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
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17793/issue9104.diff
___
Python tracker
<http://bugs.python.org/issue9104>
___
___
Python-bug
Changes by Alexander Belopolsky :
Added file: http://bugs.python.org/file17794/issue9104.diff
___
Python tracker
<http://bugs.python.org/issue9104>
___
___
Python-bug
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
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
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
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
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
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17800/issue1581183-test.diff
___
Python tracker
<http://bugs.python.org/issue1581183>
___
___
Changes by Alexander Belopolsky :
Added file: http://bugs.python.org/file17801/issue1581183-test.diff
___
Python tracker
<http://bugs.python.org/issue1581183>
___
___
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
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 = {
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
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
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
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
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
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
New submission from Alexander Myodov :
Hello,
I am using Python 2.6.5 and Cython (to embed the Python interpreter) to create
a simple launcher.exe launcher which then imports and uses the remaining logic
from the other modules, conveniently stored in a single modules.zip file (i.e.
importing
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
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
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
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
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
Changes by Alexander Belopolsky :
--
assignee: -> belopolsky
resolution: -> accepted
stage: patch review -> commit review
___
Python tracker
<http://bugs.python.o
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
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
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
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
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
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
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
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
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
Alexander Belopolsky added the comment:
This comment in datetime.__new__ makes me +0.5 on s/__/_/:
self = date.__new__(cls, year, month, day)
# XXX This duplicates __year, __month, __day for convenience
Alexander Belopolsky added the comment:
On Fri, Jul 2, 2010 at 5:23 PM, Amaury Forgeot d'Arc
wrote:
..
> Even with 2.5 int(x) cannot overflow, and returns a long when needed!
> This assert probably checks that the number has no fractional part.
Yes I've realized that. I thou
Alexander Belopolsky added the comment:
On Fri, Jul 2, 2010 at 6:00 PM, Tim Peters wrote:
>
> Tim Peters added the comment:
>
>> Do you remember why it was a good idea to
>> derive datetime from date?
>
> Why not? A datetime is a date, but with additional beha
Alexander Belopolsky added the comment:
On Fri, Jul 2, 2010 at 6:26 PM, Tim Peters wrote:
..
> I'm not going to argue about whether datetime "should have been" subclassed
> from date - fact is that it was, and since it was
> Guido's idea from the start, he would
Alexander Belopolsky added the comment:
On Fri, Jul 2, 2010 at 6:52 PM, Marc-Andre Lemburg
wrote:
..
> That said, I don't think redesigning the datetime module is part
> of this ticket, just adding a second implementation of what we
> already have in CPython :-)
I agree. I a
Alexander Belopolsky added the comment:
I am attaching a patch against sandbox version of datetime.py. With this
patch, there is a single place where subminute offset is rejected,
_check_utc_offset() function. I have also added "whole minute" asserts in
places where sub-minute p
Alexander Belopolsky added the comment:
I am attaching a patch from issue 5288 as an example of a change that I would
favor more than issue7989-cmp.diff. This patch eliminates _utcoffset and _dst
methods that duplicate utcoffset and dst, but return integer minutes rather
than a timedelta
Alexander Belopolsky added the comment:
Benjamin,
Is it too late to do anything about this. Apparently Sean committed wrong
patch and as a result 2.7 is about to be released with an error in
tzinfo.fromutc docstring. This method is confusing enough without
documentation bugs. Would you
Alexander Belopolsky added the comment:
Reverted r81681 and r81682 in r82466 and r82467.
It looks like docstring changes intended for utcoffset() landed in a docstring
for fromutc(). Given that we are very close to 2.7 release, I am not
attempting to improve the docs - just reverting an
Changes by Alexander Belopolsky :
--
stage: needs patch -> patch review
Added file: http://bugs.python.org/file17848/issue7989.diff
___
Python tracker
<http://bugs.python.org/iss
Alexander Belopolsky added the comment:
Just a nitpick: I think the code will be clearer if you switch on args' length
rather than catch IndexError:
nargs = len(args)
if nargs > 2:
...
self = args[0]
other = args[1] if nargs == 2 else ()
...
--
nosy: +be
Alexander Belopolsky added the comment:
I would like to commit this. Any objections? Changes only affect running
pickletools as __main__. Does this need to be documented in pickletools.rst?
I noticed that dis.rst does not describe running dis.py from command line.
Similarly, I cannot
Alexander Belopolsky added the comment:
Committed in r82514. I don't think this appropriate for 3.1, but will not
block it yet if someone thinks it should be merged.
--
stage: patch review -> committed/rejected
status: open -> pending
___
Changes by Alexander Belopolsky :
--
assignee: belopolsky
components: Demos and Tools
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Demo/classes/Dates.py does not work in 3.x
type: behavior
versions: Python 3.2
New submission from Alexander Belopolsky :
I am attaching a minimal patch to make included test pass.
--
keywords: +easy, patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file17850/issue9151.diff
___
Python tracker
&l
Alexander Belopolsky added the comment:
Non-existing tools removed by Mark in r82515. There are still tools (see '-'
lines above that need a README entry.)
--
nosy: +mark.dickinson
___
Python tracker
<http://bugs.python.
Alexander Belopolsky added the comment:
Also I believe 2to3 deserves to be mentioned in README.
--
___
Python tracker
<http://bugs.python.org/issue9093>
___
___
Changes by Alexander Belopolsky :
--
nosy: +georg.brandl
___
Python tracker
<http://bugs.python.org/issue9093>
___
___
Python-bugs-list mailing list
Unsubscribe:
Alexander Belopolsky added the comment:
Committed in r82517.
--
___
Python tracker
<http://bugs.python.org/issue9151>
___
___
Python-bugs-list mailing list
Unsub
Alexander Belopolsky added the comment:
Committed some minor "modernization" changes in r82521. Given that datetime.py
is in the works (see issue7989), I don't think there is any reason to polish
this demo further.
--
resolution: -> accepted
stat
New submission from Alexander Belopolsky :
Apparently introduced by a wholesale elimination of PyString_ in r57374, the
else clause in the following snippet from call_tzname is redundant:
if (!PyUnicode_Check(result)) {
PyErr_Format(PyExc_TypeError, "tzinfo.tzname()
Changes by Alexander Belopolsky :
--
keywords: +patch
nosy: +mark.dickinson
resolution: -> accepted
stage: -> commit review
Added file: http://bugs.python.org/file17851/issue9152.diff
___
Python tracker
<http://bugs.python.org/
Alexander Belopolsky added the comment:
Yes, I realized that 2+ arguments would be equivalent to none, but was too lazy
to handle that case. (Falling into interactive help may actually be better than
an error message for some users.) Terry's solution is certainly better.
Atta
Alexander Belopolsky added the comment:
On the second reading, OP's request has nothing to do with pickle.load(). In
fact, there is no coherent request here.
--
status: pending -> closed
___
Python tracker
<http://bugs.python.org/
Alexander Belopolsky added the comment:
_time.c is not supposed to be compiled into an extension. It is similar to
_math.c - if you add a line
_math _math.c
to Setup, you get a similar compile error. What needs to be done, however, is
to add _time.c to time and datetime lines. See
Alexander Belopolsky added the comment:
Committed in r82533.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue9152>
___
___
Python-
Alexander Belopolsky added the comment:
Merged in 3.1 in r82536.
--
stage: commit review -> committed/rejected
versions: +Python 3.1
___
Python tracker
<http://bugs.python.org/iss
Alexander Belopolsky added the comment:
Committed in r82547. I am leaving it open to decide whether this is a
3.1-backport candidate. Also I am not sure this is NEWS-worthy.
Jack,
Does this address your issue? Note that
>>> help(X.foo.fset)
will still not return help on X.fo
Alexander Belopolsky added the comment:
Many demos already include a self-test:
$ grep '^def test(' Demo/*/*.py
Demo/classes/Complex.py:def test():
Demo/classes/Dates.py:def test(firstyear, lastyear):
Demo/classes/Range.py:def test():
Demo/classes/Vec.py:def test():
D
Alexander Belopolsky added the comment:
I fixed Dates.py. See issue9151.
I also committed a minimal fix for Complex.py in r82524.
--
dependencies: +Demo/classes/Dates.py does not work in 3.x
nosy: +belopolsky
___
Python tracker
<h
Alexander Belopolsky added the comment:
I fixed Rev.py in r82550, but I don't think it is worth keeping in the current
form. Maybe it can be replaced with a pure python reimplementation of
builtins.reversed.
Note that slicing does not work for Rev:
>>> r = Rev([1,2,3])
>
Alexander Belopolsky added the comment:
Fixed Range.py in r82551.
--
___
Python tracker
<http://bugs.python.org/issue7962>
___
___
Python-bugs-list mailin
Changes by Alexander Belopolsky :
--
nosy: +belopolsky
___
Python tracker
<http://bugs.python.org/issue9155>
___
___
Python-bugs-list mailing list
Unsubscribe:
Alexander Belopolsky added the comment:
I am attaching a rough patch which removes timedelta -> int minutes ->
timedelta round trips from utcoffset handling code. I think the result is an
improvement, but needs more polishing.
Mark,
Do you think this is worth pursuing? I am not int
Alexander Belopolsky added the comment:
Please keep this open. This issue is separate from pickling partial objects.
--
nosy: +belopolsky
___
Python tracker
<http://bugs.python.org/issue4
Changes by Alexander Belopolsky :
--
stage: -> needs patch
versions: +Python 3.2 -Python 2.7, Python 3.1
___
Python tracker
<http://bugs.python.org/iss
Alexander Belopolsky added the comment:
The wikisource file in the report is no longer available, but with latest
wikisource and python 2.7,
$ curl
http://download.wikimedia.org/enwikisource/latest/enwikisource-latest-pages-articles.xml.bz2|
bzip2 -cd | ./python.exe convert.py /tmp 8388608
Alexander Belopolsky added the comment:
+try:
+dc = DefaultContext
+except NameError:
+pass
+
+self.prec = dc.prec if prec is None else prec
I don't quite understand the point of catching NameError here, but it looks
like if it is caugh
Changes by Alexander Belopolsky :
--
keywords: +patch
Added file: http://bugs.python.org/file17864/issue5288.diff
___
Python tracker
<http://bugs.python.org/issue5
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17857/issue5288.diff
___
Python tracker
<http://bugs.python.org/issue5288>
___
___
Python-bug
Alexander Belopolsky added the comment:
Sorry, but I don't understand the point that you are trying to make. sq_dict
is indeed considered for inclusion in python: see issue 3783.
For this issue, we need a confirmation that the problem is present in the
current ve
Alexander Belopolsky added the comment:
Hmm, it looks like patchcheck does not fix trailing whitespace in c files:
$ grep ' $' Modules/datetimemodule.c| cat -ve
$
GET_TD_DAYS(offset1) * 86400 - $
Py_DECREF(offset);$
Changes by Alexander Belopolsky :
Added file: http://bugs.python.org/file17865/issue5288.diff
___
Python tracker
<http://bugs.python.org/issue5288>
___
___
Python-bug
Changes by Alexander Belopolsky :
Removed file: http://bugs.python.org/file17864/issue5288.diff
___
Python tracker
<http://bugs.python.org/issue5288>
___
___
Python-bug
Alexander Belopolsky added the comment:
Reopening to consider removing a special case in days_before_year(..). After
r82128, year cannot be <= 0.
--
stage: committed/rejected -> commit review
status: closed -> open
Added file: http://bugs.python.org/file17869/issue9
New submission from Alexander Belopolsky :
Prior to r82454, python implementation of timedelta had the following comment:
class timedelta:
def __new__(cls, days=0, seconds=0, microseconds=0,
# XXX The following should only be used as keyword args
Alexander Belopolsky added the comment:
Similarly, it appears that
if (*m < 1 || *m > 12) {
--*m;
normalize_pair(y, m, 12);
++*m;
/* |y| can't be bigger
Alexander Belopolsky added the comment:
On Mon, Jul 5, 2010 at 1:39 PM, Antoine Pitrou wrote:
..
> -1 from me. Deprecating correct code should be done for serious
> reasons, not aesthetical (i.e. gratuitous) ones.
I would think that deprecating error-prone constructs is well within
3001 - 3100 of 4097 matches
Mail list logo