[issue9096] importlib doesn't handle valid marshalled data with invalid semantics

2010-07-01 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: Turns out that an ImportError should be raised when a bytecode object contains a non-code object. My next patch which makes SourceLoader the primary loader will have the fix. -- components: +Library (Lib) resolution: - accepted type:

[issue9134] sre bug: lastmark_save/restore

2010-07-01 Thread Armin Rigo
Armin Rigo ar...@users.sourceforge.net added the comment: It's pretty trivial to turn my x.py into a unit test, of course. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9134 ___

[issue5315] signal handler never gets called

2010-07-01 Thread Ernesto Menéndez
Changes by Ernesto Menéndez pya...@gmail.com: -- nosy: +Netto ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5315 ___ ___ Python-bugs-list mailing

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I can't reproduce this on Linux. However, I've seen an informal report of something like this happening before. It looks a lot like something threading related, but I don't see any threads in what you're doing. (Though I don't know the

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: BTW, is the behaviour consistent, or does it only occur on some runs? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9136 ___

[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2010-07-01 Thread Ernesto Menéndez
Changes by Ernesto Menéndez pya...@gmail.com: -- nosy: +Netto ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1856 ___ ___ Python-bugs-list mailing

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Okay, I can reproduce by adding a 'time.sleep(0.01)' delay into the body of the 'for name, val in locals().items():' loop. I then get (with py3k): dicki...@alberti:~/Source/py3k ./python Python 3.2a0 (py3k:82413M, Jul 1 2010, 10:21:02)

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-01 Thread Ralph Corderoy
Ralph Corderoy ralph-pythonb...@inputplus.co.uk added the comment: Google has led me here because I'm trying to see how to process find(1)'s -print0 output with Python. Perl's -0 option and $/ variable makes this trivial. find -name '*.orig' -print0 | perl -n0e unlink awk(1) has its RS,

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org wrote: I can't reproduce this on Linux. However, I've seen an informal report of something like this happening before. It looks a lot like something threading related, but I don't see any

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Removing the decimal module from the equation, the following is enough to trigger this for me. Stefan's suggestion about the profile module writing to locals sounds right on target. import profile class Context(object): def

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: class Context(object): def __init__(self): for name, val in locals().items(): setattr(self, name, val) Isn't this dodgy anyway, since 'name' and 'val' end up going into locals()? I wonder why the RuntimeError

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Still clueless about profile.py, but I think it creates a parallel stack, and overwriting of locals legitimately occurs in that stack, producing the Exception. So it would appear that by design one simply cannot iterate over locals when

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org wrote: Mark Dickinson dicki...@gmail.com added the comment: class Context(object): def __init__(self): for name, val in locals().items(): setattr(self, name, val)

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: The tracker doesn't handle code when posted by mail. Here's the code again: for name, val in locals().items(): ... print(locals()) ... {'name': '__builtins__', 'val': module 'builtins' (built-in), '__builtins__': module 'builtins'

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Ah, it looks like 'locals()' is somewhat magical. Its docstring says: Update and return a dictionary containing the current scope's local variables. So I think this explains your (Stefan's) results: in either case, you evaluate locals()

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: it looks like 'locals()' is somewhat magical ... and Objects/frameobject.c is the place to go for a full understanding. PyFrame_FastToLocals is the 'updating' function that updates the locals dict from the 'fast locals' object.

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Here's a patch. It's a little ugly, but I don't see a better way that avoids locals(). Using **kwargs is an option, but would mean abandoning the current nice feature that unexpected keyword arguments raise TypeError (or alternatively,

[issue8324] add a distutils test command

2010-07-01 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- resolution: - accepted stage: - needs patch versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8324 ___

[issue9126] errors='replace' does not work at Windows command line

2010-07-01 Thread John Van Praag
John Van Praag j...@jvp247.com added the comment: According to the documentation of the open function: errors is an optional string that specifies how encoding and decoding errors are to be handled–this cannot be used in binary mode. Pass 'strict' to raise a ValueError exception if there is an

[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans
Thomas Jollans tho...@jollans.com added the comment: Two more patches: Firstly, this patch (array_3.2_fromstring.diff) is nearly identical to array2.diff. y* would (again) have to be changed to s* to apply this to 3.1 -- Added file:

[issue9126] errors='replace' does not work at Windows command line

2010-07-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: The characters are fine when you read them (that is, they decode correctly to unicode). They are only invalid when you write them to the windows terminal, which can't handle all the valid characters that are in the file. The Idle

[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans
Thomas Jollans tho...@jollans.com added the comment: Secondly, this is my attempt to add the more sensibly named {to|from}bytes methods, and to deprecate {to|from}string. I doubt it's perfect, maybe there's some policy on deprecating methods that I didn't find? This may be better discussed

[issue8595] Explain the default timeout in http-client-related libraries

2010-07-01 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I think you could preserve backward compatibility by doing something like the following (in httplib): _sentinel = object() __HTTP_DEFAULT_TIMEOUT = _sentinel In httplib.HTTPConnection.__init__(), in Python 2.6. def __init__(self, host,

[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans
Changes by Thomas Jollans tho...@jollans.com: Added file: http://bugs.python.org/file17828/tofrombytes.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8990 ___

[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans
Changes by Thomas Jollans tho...@jollans.com: Removed file: http://bugs.python.org/file17827/tofrombytes.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8990 ___

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

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net 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

[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: +1 on using the full name, PyUnicodeObject The shorthand PyUnicode is too easy to confuse with Py_UNICODE (an actual type). -- nosy: +stutzbach ___ Python tracker

[issue9137] x.update(red=5, blue=6, other=7) doesn't work, where x is a MutableMapping

2010-07-01 Thread Daniel Stutzbach
New submission from Daniel Stutzbach dan...@stutzbachenterprises.com: Simple example, using collections.OrderedDict: import collections x = collections.OrderedDict() x.update(red=5, blue=6, other=7) Traceback (most recent call last): File stdin, line 1, in module File

[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: To avoid the strange-looking “a PyUnicodeObject object”, one can write “an instance of PyUnicodeObject”. Victor, have you kept the around 0 and 1? -- resolution: - accepted stage: - patch review

[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: To avoid the strange-looking “a PyUnicodeObject object”, one can write “an instance of PyUnicodeObject”. Or simply a PyUnicodeObject. -- ___ Python tracker rep...@bugs.python.org

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

2010-07-01 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: In any case, my threshold for moving this forward is for someone to review the code in sandbox. Ok some comments: - I find the _cmp() and __cmp() indirection poor style in 3.x, especially when you simply end up comparing self._getstate() and

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

2010-07-01 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr 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 simply not

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

2010-07-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Please don't update the reST document. The support module should never have been documented outside the module itself, because now we are pretty much committed to otherwise needless backward compatibility for the stuff that is

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

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net 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 rep...@bugs.python.org wrote: .. - I find the _cmp() and __cmp() indirection poor style in 3.x, especially when

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

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Thu, Jul 1, 2010 at 12:18 PM, Antoine Pitrou rep...@bugs.python.org 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.

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

2010-07-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com 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 wilfully make. --

[issue1643370] recursive urlparse

2010-07-01 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: David, Is the stage unit test needed proper for this or was it by mistake? Anatoly, I thought closing this feature request was fine, because I considered that with namedtuple the desired attributes of url's were obtained as ParsedTuple

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark, the patch looks good. I don't find it ugly, but anyway, here's a bike shed version. :) The main point is that I'd like the flags and traps sections to be set apart visually while compressing the boilerplate. -- Added file:

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Nice shade of blue! Just a couple of red spots that I'd prefer repainted, namely: (1) please put bodies of 'try:' and 'except:' on separate lines, and (2) please use 'except NameError' instead of a bare except. And a couple of points that

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

2010-07-01 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: R. David Murray rdmur...@bitdance.com 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

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Stefan, one other thought: please also bear in mind that we're restricted to Python 2.3 syntax in the 2.x version of decimal, so any post-Python 2.3-isms will have to be rewritten when the patch is backported. (E.g., use of conditional

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

2010-07-01 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I agree. Do you think I should just define __lt__ and use functools.total_ordering decorator? I had forgotten about functools.total_ordering. Yes, very good idea. Note that current implementation mimics what is done in C, but I think

[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-07-01 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Ported to py3k in r82413. Some test with non-BMP characters should probably be added. The patch should still be ported to 2.6 and 3.1. -- ___ Python tracker rep...@bugs.python.org

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark, good point about 2.3 compatibility. The unit tests diverge quite a bit though between 2.5, 2.6 and 2.7. I like {s: 0 for s in _signals} slightly better here (but I like dict/list comprehensions in general). So, the new patch

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Looks good to me. Please go ahead and apply it to the 3.2 and 3.1 branches, if you want. (Or just assign back to me if you prefer.) It should also be applied to 2.7 and 2.6, eventually, but we should probably wait until after the 2.7

[issue1643370] recursive urlparse

2010-07-01 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: Too bad that request from users who are not eligible to produce a patch are not accepted by Python community. =/ -- ___ Python tracker rep...@bugs.python.org

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Stylistically, it would be nice to eliminate the local variable reassignment entirely: self.Emin = DefaultContext.Emin if Emin is None else Emin self.Emax = DefaultContext.Emax if Emax is None else Emax self._ignored_flags =

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: [Raymond] self.Emin = DefaultContext.Emin if Emin is None else Emin I agree that looks better. But we can't spell it that way in 2.x (since conditional expressions aren't 2.3 compatible), and I'd prefer to keep the 2.x and 3.x versions

[issue1643370] recursive urlparse

2010-07-01 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Why shouldn't you be eligible to produce patches to Python? And yes, requests without patches will sometimes take longer, or be evaluated differently, since we're all volunteers here, and an existing patch, even if unusable it the submitted form,

[issue1643370] recursive urlparse

2010-07-01 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +merwok ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1643370 ___ ___ Python-bugs-list mailing

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I'm not sure that I care about 2.3 compatibility anymore (I was the one who made the rule about 2.3 compatibility and made sure that it was just a preference, not an absolute rule -- as time goes on, it is of less and less

[issue1643370] recursive urlparse

2010-07-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Anatoly, when I said I was closing the issue for lack of interest, I meant that you had not produced a candidate patch, and no one else had shown any interest in creating one. If you wish to produce a candidate patch we can reopen the

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: ISTM, 2.5 compatible is probably good enough. Okay; that's fine with me. Now we can finally turn that from_float = classmethod(from_float) into a proper @classmethod decorator. :) I also don't think that the 2.x-to-3.x maintenance issue

[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread Aahz
New submission from Aahz a...@pythoncraft.com: http://docs.python.org/dev/tutorial/classes.html Chapter 9 of the Tutorial contains this intro paragraph: Python's class mechanism adds classes to the language with a minimum of new syntax and semantics. It is a mixture of the class

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Yuv Gre
Yuv Gre ubershme...@gmail.com added the comment: Now that we're on the subject of from_float, I just recalled this slight issue: Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import decimal

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

2010-07-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: If not in test.support, then where? Unless there's some reason for user code or other implementations (or stdlib code itself) to access that map, it seems to me that test.support is exactly where it belongs. Generic test support (that

[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: +1 on the new wording. Nits: * Since many OOP languages don't support multiple inheritance, I don't think we can call multiple inheritance one of the standard features of Object Oriented Programming. * Eventhough the

[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: Much better definition. I stripped it down a little to avoid mechanism repetition. Compared with other programming languages, Python provides object oriented approach with a minimum of new syntax and semantics. Its class

[issue5673] Add timeout option to subprocess.Popen

2010-07-01 Thread Dave Malcolm
Dave Malcolm dmalc...@redhat.com added the comment: The patch has bitrotted somewhat; I've had a go at reworking it so it applies against the latest version of trunk (r82429). All tests pass (or are skipped) on this x86_64 Linux box --with-pydebug (Fedora 13) There are still some TODOs in

[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I also don't think that the 2.x-to-3.x maintenance issue is that big a deal any more; it would be surprising if the 2.x version of Decimal sees anything more than minor changes (doc fixes, etc.) from this point on. So

[issue9139] Add examples for str.format()

2010-07-01 Thread Ezio Melotti
New submission from Ezio Melotti ezio.melo...@gmail.com: The attached patch adds a section with examples about str.format() after http://docs.python.org/library/string.html#format-specification-mini-language . The patch needs some small improvements: 1) the examples in the previous sections

[issue1596321] KeyError at exit after 'import threading' in other thread

2010-07-01 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: A follow-on re the cx_Freeze issue: I looked at the source code, and found it doesn't seem to be doing any thread creation. But I found that in the initscripts/Console.py, there are the following lines: if sys.version_info[:2] =

[issue9140] SocketServer.BaseRequestHandler not a new-style class?

2010-07-01 Thread Peter Froehlich
New submission from Peter Froehlich peter.hans.froehl...@gmail.com: I tried to do this: class Handler(SimpleHTTPRequestHandler): def do_GET(self): super(Handler, self).do_GET() print self.path However super fails: TypeError: super() argument 1 must be type, not classobj Looking up