planar 0.3 released
I'm happy to announce the release of the planar 0.3 2D geometry library for Python. The project, although still under development, already has quite a few useful features. The focus of the library is to provide a clean, simple, documented 2D geometry api, with high performance implementations in both Python and C, available under a liberal license. You can check out the docs and grab it from pypi here: http://pypi.python.org/pypi/planar/0.3 Enjoy. -Casey -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
[ANN]: circuits-1.5 (Lightweight Event driven Asynchronous Application Framework)
Hi, I'm pleased to announce the release of circuits-1.5 This release brings to circuits.web a new dispatcher: WebSockets This allows you to build a web application and process WebSocket connections in the same process/thread. (See the test) This release also includes a number of minor bug fixes and greater test coverage. For more information see the PyPi page: http://pypi.python.org/pypi/circuits/1.5 cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Problem with python 3.2 and circular imports
Hi all I thought I was getting the hang of circular imports, but after upgrading to python 3.2 I am stumped again. I know some people think that circular imports are always bad, but others suggest that, provided you understand the potential problems, they can be acceptable. Assume the following structure - main.py /pkg __init__.py mod1.py mod2.py main.py from pkg import mod1 mod1.py import mod2 mod2.py import mod1 Using python 2.6, running main.py works. After running 2to3.py on the above directory, mod1.py was changed to 'from . import mod2' and mod2.py was changed to 'from . import mod1'. With python 3.2, it now fails with the following traceback - Traceback (most recent call last): File main.py, line 1, in module from pkg import mod1 File pkg\mod1.py, line 1, in module from . import mod2 File pkg\mod2.py, line 1, in module from . import mod1 ImportError: cannot import name mod1 I have read the relevant peps and various other material, understood them to a certain extent, tried several alternatives, but could not find a solution. I have found a hack that works, but I don't like it very much. I added the following to '__init__.py' - import os import sys sys.path.insert(0, os.path.dirname(__file__)) This adds the package name into the search path. Then I changed mod1.py and mod2.py back to the original 'import mod2' and 'import mod1'. It works, but it seems to be defeating the purpose of PEP 328, which I thought was an improvement. Any comments or suggestions will be appreciated. Frank Millman -- http://mail.python.org/mailman/listinfo/python-list
issue on internal import in a package
Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
On Feb 27, 8:11 pm, 人言落日是天涯,望极天涯不见家 kelvin@gmail.com wrote: Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? PS. This issue occurred on Python3.2 It's okay in the Python2.6 Python2.5 -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
人言落日是天涯,望极天涯不见家 kelvin@gmail.com writes: Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: This works fine for me:: $ mkdir --parents app/module/ $ touch app/module/__init__.py $ printf import b\n app/module/a.py $ printf def foo(): pass\n app/module/b.py $ printf from module import a\n app/test.py $ find . . ./app ./app/module ./app/module/__init__.py ./app/module/a.py ./app/module/b.py ./app/test.py $ python app/test.py Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? I get no errors; the code appears to run fine. Perhaps the scenario is not exactly as you describe? -- \ “If we listen only to those who are like us, we will squander | `\ the great opportunity before us: To live together peacefully in | _o__)a world of unresolved differences.” —David Weinberger | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with python 3.2 and circular imports
Frank Millman fr...@chagford.com writes: Assume the following structure - main.py /pkg __init__.py mod1.py mod2.py main.py from pkg import mod1 mod1.py import mod2 mod2.py import mod1 What are you expecting the result to be? If it's about sharing objects between the modules, why not break the circular dependency: factor out the common code to a module that both the others import? Any comments or suggestions will be appreciated. Special cases aren't special enough to break the rules. If you think you have a practical reason to do so, it would be best to make it explicit when asking for help about this. -- \ “The long-term solution to mountains of waste is not more | `\ landfill sites but fewer shopping centres.” —Clive Hamilton, | _o__)_Affluenza_, 2005 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN]VTD-XML 2.10
Jimmy, How does VTD-XML compare to XML tools in the stdlib or to 3rd party alternatives like lxml? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
On Feb 27, 8:40 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: 人言落日是天涯,望极天涯不见家 kelvin@gmail.com writes: Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: This works fine for me:: $ mkdir --parents app/module/ $ touch app/module/__init__.py $ printf import b\n app/module/a.py $ printf def foo(): pass\n app/module/b.py $ printf from module import a\n app/test.py $ find . . ./app ./app/module ./app/module/__init__.py ./app/module/a.py ./app/module/b.py ./app/test.py $ python app/test.py Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? I get no errors; the code appears to run fine. Perhaps the scenario is not exactly as you describe? -- \ “If we listen only to those who are like us, we will squander | `\ the great opportunity before us: To live together peacefully in | _o__) a world of unresolved differences.” —David Weinberger | Ben Finney Thanks for your reply. What's the version of your Python? My version is 3.2. Python 2.5/2.6 doesn't have this issue. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python getting stuck
On 26-Feb-11 18:55 PM, Shanush Premathasarathan wrote: Hi All, When I use cut, copy, paste, and any keyboard shortcuts, Python freezes and I am unable to use Python. Please Help as quick as possible!!! Thanks a lot. Kind Regards Big Python fan! Shanush What operating system are you using? Colin W. -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
Ben Finney ben+pyt...@benfinney.id.au wrote in message news:87ei6t646h@benfinney.id.au... 人言落日是天涯,望极天涯不见家 kelvin@gmail.com writes: Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: This works fine for me:: $ mkdir --parents app/module/ $ touch app/module/__init__.py $ printf import b\n app/module/a.py $ printf def foo(): pass\n app/module/b.py $ printf from module import a\n app/test.py $ find . . ./app ./app/module ./app/module/__init__.py ./app/module/a.py ./app/module/b.py ./app/test.py $ python app/test.py Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? I get no errors; the code appears to run fine. Perhaps the scenario is not exactly as you describe? I get exactly the same result as the OP, using python 3.2 on both windows and linux. It works using python 2.6. I can fix it by changing a.py from 'import b' to 'from . import b'. As I understand it, the reason is that python 3.x will no longer look for an absolute import in the current package - it will only look in sys.path. Frank Millman -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
On Feb 27, 9:22 pm, Frank Millman fr...@chagford.com wrote: Ben Finney ben+pyt...@benfinney.id.au wrote in message news:87ei6t646h@benfinney.id.au... 人言落日是天涯,望极天涯不见家 kelvin@gmail.com writes: Here is a simple example: [app] [module] __init__.py -- empty a.py -- import b b.py -- defined a function foo() test.py In the test.py, contains the below statement: from module import a Execute the test.py will get error: This works fine for me:: $ mkdir --parents app/module/ $ touch app/module/__init__.py $ printf import b\n app/module/a.py $ printf def foo(): pass\n app/module/b.py $ printf from module import a\n app/test.py $ find . . ./app ./app/module ./app/module/__init__.py ./app/module/a.py ./app/module/b.py ./app/test.py $ python app/test.py Traceback (most recent call last): File stdin, line 1, in module File module\a.py, line 1, in module import b ImportError: No module named b Why the b.py can not be found by a.py? I get no errors; the code appears to run fine. Perhaps the scenario is not exactly as you describe? I get exactly the same result as the OP, using python 3.2 on both windows and linux. It works using python 2.6. I can fix it by changing a.py from 'import b' to 'from . import b'. As I understand it, the reason is that python 3.x will no longer look for an absolute import in the current package - it will only look in sys.path. Frank Millman This behavior is by design or just a bug for Python3.x ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with python 3.2 and circular imports
Ben Finney ben+pyt...@benfinney.id.au wrote in message news:87aahh6401@benfinney.id.au... Frank Millman fr...@chagford.com writes: Assume the following structure - main.py /pkg __init__.py mod1.py mod2.py main.py from pkg import mod1 mod1.py import mod2 mod2.py import mod1 What are you expecting the result to be? Simply that mod1 can refer to objects in mod2, and mod2 can refer to objects in mod1. If it's about sharing objects between the modules, why not break the circular dependency: factor out the common code to a module that both the others import? Any comments or suggestions will be appreciated. Special cases aren't special enough to break the rules. If you think you have a practical reason to do so, it would be best to make it explicit when asking for help about this. I am trying to understand what 'the rule' is. Your advice above suggests that you are one of those who recommend that circular imports are best avoided altogether. In an ideal world I would agree. However, the fact is that, no doubt due to a mental block I have, I do find myself in this situation from time to time, and I have not seen anything in the documentation or other literature that says it is absolutely wrong. Therefore, while I do try to avoid circular imports where possible, I would also like to know how to manage it in situations where I don't see a simple alternative. From everything I have read about how the import mechanism works, I don't understand *why* the above construct fails. That is actually what I am asking for help with. Thanks Frank -- http://mail.python.org/mailman/listinfo/python-list
I'm happy with Python 2.5
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best the fastest version) -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
Python 3 is a tempor. lapse of reason. Just my an intuitive sensation, nothing objective in it. -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
人言落日是天涯,望极天涯不见家 kelvin@gmail.com wrote in message news:fa94323b-d859-4599-b236-c78a22b3d...@t19g2000prd.googlegroups.com... On Feb 27, 9:22 pm, Frank Millman fr...@chagford.com wrote: This behavior is by design or just a bug for Python3.x ? Definitely by design. Have a look at PEP 328 - http://www.python.org/dev/peps/pep-0328/ In Python 2.4 and earlier, if you're reading a module located inside a package, it is not clear whether import foo refers to a top-level module or to another module inside the package. As Python's library expands, more and more existing package internal modules suddenly shadow standard library modules by accident. It's a particularly difficult problem inside packages because there's no way to specify which module is meant. To resolve the ambiguity, it is proposed that foo will always be a module or package reachable from sys.path. This is called an absolute import. HTH Frank -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
On Sun, 27 Feb 2011 05:34:44 -0800, n00m wrote: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best the fastest version) Congratulations. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
On Feb 27, 9:38 pm, Frank Millman fr...@chagford.com wrote: 人言落日是天涯,望极天涯不见家 kelvin@gmail.com wrote in message news:fa94323b-d859-4599-b236-c78a22b3d...@t19g2000prd.googlegroups.com... On Feb 27, 9:22 pm, Frank Millman fr...@chagford.com wrote: This behavior is by design or just a bug for Python3.x ? Definitely by design. Have a look at PEP 328 -http://www.python.org/dev/peps/pep-0328/ In Python 2.4 and earlier, if you're reading a module located inside a package, it is not clear whether import foo refers to a top-level module or to another module inside the package. As Python's library expands, more and more existing package internal modules suddenly shadow standard library modules by accident. It's a particularly difficult problem inside packages because there's no way to specify which module is meant. To resolve the ambiguity, it is proposed that foo will always be a module or package reachable from sys.path. This is called an absolute import. HTH Frank Yes, it's okay with the change in a.py with below line: from . import b But another issue occurred if I want to run the a.py separately. $ cd module $ python a.py Traceback (most recent call last): File a.py, line 1, in module from . import b ValueError: Attempted relative import in non-package Does that mean the relative import only allowed in the package. And it cannot be run as __main__ program unless I change the relative import back to absolute import? I think this behavior is strange and difficult to use. Doesn't -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with python 3.2 and circular imports
On Sun, 27 Feb 2011 12:08:12 +0200, Frank Millman wrote: Assume the following structure - main.py /pkg __init__.py mod1.py mod2.py main.py from pkg import mod1 mod1.py import mod2 mod2.py import mod1 If you change the import mod* lines to import pkg.mod* it works for me in Python 3.1 and 3.2. According to my understand of PEP 328, from . import mod* should work, but I agree with you that it doesn't. If you get rid of the circular import, it does work. So I suspect a bug. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
what the hell does that have to do with anything On Sun, Feb 27, 2011 at 5:34 PM, n00m n...@narod.ru wrote: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best the fastest version) -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
Steve, see a list of accepted langs there, in bottom dropdown: http://www.spoj.pl/submit/ There *was* Python 2.6. Then admins shifted back to 2.5. People vote by their legs. -- http://mail.python.org/mailman/listinfo/python-list
Re: issue on internal import in a package
人言落日是天涯,望极天涯不见家 kelvin@gmail.com wrote in message news:9529d52b-01b2-402c-a0a0-1e9240038...@l14g2000pre.googlegroups.com... On Feb 27, 9:38 pm, Frank Millman fr...@chagford.com wrote: 人言落日是天涯,望极天涯不见家 kelvin@gmail.com wrote in message news:fa94323b-d859-4599-b236-c78a22b3d...@t19g2000prd.googlegroups.com... On Feb 27, 9:22 pm, Frank Millman fr...@chagford.com wrote: This behavior is by design or just a bug for Python3.x ? Definitely by design. Have a look at PEP 328 -http://www.python.org/dev/peps/pep-0328/ In Python 2.4 and earlier, if you're reading a module located inside a package, it is not clear whether import foo refers to a top-level module or to another module inside the package. As Python's library expands, more and more existing package internal modules suddenly shadow standard library modules by accident. It's a particularly difficult problem inside packages because there's no way to specify which module is meant. To resolve the ambiguity, it is proposed that foo will always be a module or package reachable from sys.path. This is called an absolute import. HTH Frank Yes, it's okay with the change in a.py with below line: from . import b But another issue occurred if I want to run the a.py separately. $ cd module $ python a.py Traceback (most recent call last): File a.py, line 1, in module from . import b ValueError: Attempted relative import in non-package Does that mean the relative import only allowed in the package. And it cannot be run as __main__ program unless I change the relative import back to absolute import? I think this behavior is strange and difficult to use. I think that PEP 366 addresses your question - http://www.python.org/dev/peps/pep-0366/ I came across this while investigating a separate problem. It looks a bit complicated, and I don't have such a requirement, so I did not look at it too closely. Have a read and see if it solves your problem. If not post a follow-up message here and see if someone else can offer more information. Frank -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
On Feb 27, 3:58 pm, Grigory Javadyan grigory.javad...@gmail.com wrote: what the hell does that have to do with anything On Sun, Feb 27, 2011 at 5:34 PM, n00m n...@narod.ru wrote: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best the fastest version) -- http://mail.python.org/mailman/listinfo/python-list Am I turmoiling your wishful thinking? You may nourish it till the end of time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with python 3.2 and circular imports
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:4d6a56aa$0$29972$c3e8da3$54964...@news.astraweb.com... On Sun, 27 Feb 2011 12:08:12 +0200, Frank Millman wrote: Assume the following structure - main.py /pkg __init__.py mod1.py mod2.py main.py from pkg import mod1 mod1.py import mod2 mod2.py import mod1 If you change the import mod* lines to import pkg.mod* it works for me in Python 3.1 and 3.2. According to my understand of PEP 328, from . import mod* should work, but I agree with you that it doesn't. If you get rid of the circular import, it does work. So I suspect a bug. Thanks, Steven. I confirm that 'import pkg.mod* works. Unfortunately I am using sub-packages as well, which means that to refer to an object in the sub-package I need to use w.x.y.z every time, which gets to be a lot of typing! I will stick to my hack of putting the package name in sys.path for now, unless someone comes up with a better idea. Frank -- http://mail.python.org/mailman/listinfo/python-list
Re: Python getting stuck
Colin J. Williams wrote: On 26-Feb-11 18:55 PM, Shanush Premathasarathan wrote: When I use cut, copy, paste, and any keyboard shortcuts, Python freezes and I am unable to use Python. Please Help as quick as possible!!! What operating system are you using? If it's some kind of Unix, are you using a text console, or X? If X, what window manager? -- Tom Zych / freethin...@pobox.com Quidquid latine dictum sit, altum viditur. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
http://www.spoj.pl/problems/TMUL/ Python's print a * b gets Time Limit Exceeded. = PHP's code = fscanf(STDIN, %d\n, $tcs); while ($tcs--) { fscanf(STDIN, %s %s\n, $n, $m); echo bcmul($n, $m, 0).\n; } = does it in 4.8s -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
n00m wrote: Am I turmoiling your wishful thinking? You may nourish it till the end of time. Let us cease to nourish those fabled ones who dwell under bridges. -- Tom Zych / freethin...@pobox.com Quidquid latine dictum sit, altum viditur. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm happy with Python 2.5
On Sun, Feb 27, 2011 at 07:34, n00m n...@narod.ru wrote: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best the fastest version) -- http://mail.python.org/mailman/listinfo/python-list Trolls should also be happy... -- http://mail.python.org/mailman/listinfo/python-list
Re: Python getting stuck
On 2/26/2011 5:10 PM Dan Stromberg said... Agreed, a more detailed description would greatly help us help you, but if you're in the standard windows terminal emulator widget (command.com http://command.com, cmd.exe, powershell), then don't click in the window without first turning on quick edit mode. Otherwise the emulator will just act silly. It's kind of astonishing that any computer company would allow such an annoying bug to live so long. Well, people who are aware of command line terminal emulators are not the manufacturer's primary target audience. Would be kinda like Henry Ford offering red cars... Emile -- http://mail.python.org/mailman/listinfo/python-list
Python Language Question?
Can someone give and explanation of what is happening with the following: a,b = 0,1 # this assigns a = 0 and b = 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a=0 b=1 while b 1000: ... print b ... a = b ... b = a+b ... 1 2 4 8 16 32 64 128 256 512 Why is this statement .. a, b = b, a+b different to ... a = b ... b = a+b -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Language Question?
On Sun, Feb 27, 2011 at 11:45 AM, Paul Symonds paul.j.symo...@gmail.com wrote: Can someone give and explanation of what is happening with the following: a,b = 0,1 # this assigns a = 0 and b = 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a=0 b=1 while b 1000: ... print b ... a = b ... b = a+b ... 1 2 4 8 16 32 64 128 256 512 Why is this statement .. a, b = b, a+b Python evaluates the entire right side of the assignment, then assigns it to the left side. So if a=1 and b=2, then a, b = b, a+b a,b = 2, 1+2 a,b = 2, 3 a = 2 b = 3 different to ... a = b ... b = a+b Here, you're evaluating sequentially. a = b a = 2 b = a + b b = 2 + 2 b = 4. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Various behaviors of doctest
Using the doctest module, I get three different outputs: 1) From the Terminal shell, I see a full report: python ~/Sites/Sectrum/Filter.py -v 2) From the Terminal interactive session, I see an abbreviated report of only the failures: from doctest import testmod; testmod(Filter) 3) From a browser CGI, I see a named tuple: from doctest import testmod; doctest.testmod() This returns output like: TestResults(failed=1, attempted=5) The browser is invoking the exact same code as the shell doctest, so why should it return a named tuple? And how do I get it to return the full text so I can read it in the browser? -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Language Question?
On 27/02/2011 16:45, Paul Symonds wrote: Can someone give and explanation of what is happening with the following: a,b = 0,1 # this assigns a = 0 and b = 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a=0 b=1 while b 1000: ... print b ... a = b ... b = a+b ... 1 2 4 8 16 32 64 128 256 512 Why is this statement .. a, b = b, a+b different to ... a = b ... b = a+b Because in the statement a, b = b, a + b Python evaluates both expressions on the RHS before assigning their values to the variables on the LHS, whereas in the statements a = b b = a + b Python assigns the RHS of the first statement to the variable a, /then/ evaluates the RHS of the second statement; the value of a has already been changed by the time the RHS of the second statement gets evaluated. So e.g. if a = 0 and b = 1, then the first statement says to let a = 1, b = 0 + 1, while the other two statements say to let a = 1, then b = 1 + 1 (the first 1 being the new value of a). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Language Question?
cheers -- http://mail.python.org/mailman/listinfo/python-list
python3.2m installed as (additional) binary
Hi, I just downloaded, built and altinstalled Python3.2 on Linux x64. I noticed that in /usr/local/bin I have two identical (says diff) binaries called Python3.2 and Python3.2m. Is this expected? I can find very little reference to them apart from a short discussion in python-dev where someone asks if users will be confused by this and Barry Warsaw replies saying that they won't see them (well, I do!). All I did was the usual ./configure; make; sudo make altinstall So is this a bug? Andrew pl6 Python-3.2: ls -l /usr/local/bin/python3.2* -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2 -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2m -rwxr-xr-x 1 root root1826 2011-02-27 13:03 /usr/local/bin/python3.2m-config pl6 Python-3.2: diff /usr/local/bin/python3.2 /usr/local/bin/python3.2m pl6 Python-3.2: -- http://mail.python.org/mailman/listinfo/python-list
mortar_rdb 1.1.0 released!
Hi All, I'm pleased to announce a new release of mortar_rdb. This package ties together SQLAlchemy, sqlalchemy-migrate and the component architecture to make it easy to develop projects using SQLAlchemy through their complete lifecycle. This release allows you to register SessionExtensions with your sessions. If you'd like to see what mortar_rdb can do for you, please have a read of the narrative usage docs, which give a quick run through of the lifespan of a project developers using mortar_rdb: http://packages.python.org/mortar_rdb/use.html Full package details including mailing list, irc and bug tracker details can be found here: http://www.simplistix.co.uk/software/python/mortar_rdb cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: python3.2m installed as (additional) binary
andrew cooke wrote: I just downloaded, built and altinstalled Python3.2 on Linux x64. I noticed that in /usr/local/bin I have two identical (says diff) binaries called Python3.2 and Python3.2m. Is this expected? I can find very little reference to them apart from a short discussion in python-dev where someone asks if users will be confused by this and Barry Warsaw replies saying that they won't see them (well, I do!). All I did was the usual ./configure; make; sudo make altinstall So is this a bug? pl6 Python-3.2: ls -l /usr/local/bin/python3.2* -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2 -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2m -rwxr-xr-x 1 root root1826 2011-02-27 13:03 /usr/local/bin/python3.2m-config pl6 Python-3.2: diff /usr/local/bin/python3.2 /usr/local/bin/python3.2m pl6 Python-3.2: It looks like they're hard links of each other. Try: ls -li /usr/local/bin/python3.2* Are the inode numbers the same? I suspect the m name is what gets built and the no m is an alias for backwards-compatibility. Not sure why they did the m, though. -- Tom Zych / freethin...@pobox.com Quidquid latine dictum sit, altum viditur. -- http://mail.python.org/mailman/listinfo/python-list
Re: python3.2m installed as (additional) binary
Tom Zych wrote: andrew cooke wrote: -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2 -rwxr-xr-x 2 root root 7368810 2011-02-27 13:03 /usr/local/bin/python3.2m I suspect the m name is what gets built and the no m is an alias for backwards-compatibility. Not sure why they did the m, though. Ah, this may be it: http://bugs.python.org/issue9807 Search for build flag. Apparently the m indicates that it was compiled with a nonstandard compiler option, or some such; maybe something to do with being on a 64-bit platform. The makefile or configure log may shed some light. -- Tom Zych / freethin...@pobox.com Quidquid latine dictum sit, altum viditur. -- http://mail.python.org/mailman/listinfo/python-list
Re: python3.2m installed as (additional) binary
[Sorry I clicked the wrong button so I think my prev reply went only to Tom] Thanks. Yes, they're hard linked. And the bug report mentions PEP 3149 which says that m means --with-pymalloc was used http://www.python.org/dev/peps/pep-3149/ Cheers, Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: Various behaviors of doctest
On Sun, 27 Feb 2011 08:55:10 -0800, Gnarlodious wrote: Using the doctest module, I get three different outputs: 1) From the Terminal shell, I see a full report: python ~/Sites/Sectrum/Filter.py -v Can we assume that Filter.py, whatever that is, runs doctest.testmod()? 2) From the Terminal interactive session, I see an abbreviated report of only the failures: from doctest import testmod; testmod(Filter) That's because you haven't specified the verbose option, either by injecting -v into sys.argv, or by verbose=True as an argument to testmod. 3) From a browser CGI, I see a named tuple: from doctest import testmod; doctest.testmod() This returns output like: TestResults(failed=1, attempted=5) The browser is invoking the exact same code as the shell doctest, so why should it return a named tuple? Because testmod *always* returns a named tuple. Read the Fine Manual at the interactive interpreter with: help(testmod) And how do I get it to return the full text so I can read it in the browser? You don't. Consider a simplified version: def testmod(): print lots of stuff return (failures, total) If you want to capture lots of stuff, you have to either play nasty tricks with replacing standard out with a StringIO instance, or similar, or you have to look at the implementation of testmod() and re-implement it yourself. Oh, here's a thought, if you're running Python 3, you could monkey-patch doctest: # COMPLETELY UNTESTED!!! from stringio import StringIO from functools import partial buffer = StringIO() myprint = partial(print, file=buffer) doctest.print = myprint doctest.testmod() Now somehow you have to pass buffer.as_string() to your CGI program, in whatever way you would normally do so. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
nntplib encoding problem
Hi, I'm using python 3.2 and got the following error: nntpClient = nntplib.NNTP_SSL(...) nntpClient.group(alt.binaries.cd.lossless) nntpClient.over((534157,534157)) ... 'subject': 'Myl\udce8ne Farmer - Anamorphosee (Japan Edition) 1995 [02/41] Back.jpg yEnc (1/3)' ... overview = nntpClient.over((534157,534157)) print(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed I'm not sure if I should report this as a bug in nntplib or if I'm doing something wrong. Note that I get the same error if I try to write this data to a file: h = open(output.txt, a) h.write(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed Thanks, Laurent -- http://mail.python.org/mailman/listinfo/python-list
Re: Various behaviors of doctest
Yeah, I just spent about 2 hours trying everything I could think of... without success. Including your suggestions. Guess I'll have to skip it. But thanks for the ideas. -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list
Re: nntplib encoding problem
On 28/02/2011 01:31, Laurent Duchesne wrote: Hi, I'm using python 3.2 and got the following error: nntpClient = nntplib.NNTP_SSL(...) nntpClient.group(alt.binaries.cd.lossless) nntpClient.over((534157,534157)) ... 'subject': 'Myl\udce8ne Farmer - Anamorphosee (Japan Edition) 1995 [02/41] Back.jpg yEnc (1/3)' ... overview = nntpClient.over((534157,534157)) print(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed I'm not sure if I should report this as a bug in nntplib or if I'm doing something wrong. Note that I get the same error if I try to write this data to a file: h = open(output.txt, a) h.write(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed It's looks like the subject was originally encoded as Latin-1 (or similar) (b'Myl\xe8ne Farmer - Anamorphosee (Japan Edition) 1995 [02/41] Back.jpg yEnc (1/3)') but has been decoded as UTF-8 with surrogateescape passed as the errors parameter. You can get the correct Unicode by encoding as UTF-8 with surrogateescape and then decoding as Latin-1: overview[1][0][1]['subject'].encode(utf-8, surrogateescape).decode(latin-1) -- http://mail.python.org/mailman/listinfo/python-list
Re: nntplib encoding problem
At 08:12 PM 2/27/2011, you wrote: On 28/02/2011 01:31, Laurent Duchesne wrote: Hi, I'm using python 3.2 and got the following error: nntpClient = nntplib.NNTP_SSL(...) nntpClient.group(alt.binaries.cd.lossless) nntpClient.over((534157,534157)) ... 'subject': 'Myl\udce8ne Farmer - Anamorphosee (Japan Edition) 1995 [02/41] Back.jpg yEnc (1/3)' ... overview = nntpClient.over((534157,534157)) print(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed I'm not sure if I should report this as a bug in nntplib or if I'm doing something wrong. Note that I get the same error if I try to write this data to a file: h = open(output.txt, a) h.write(overview[1][0][1]['subject']) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'utf-8' codec can't encode character '\udce8' in position 3: surrogates not allowed It's looks like the subject was originally encoded as Latin-1 (or similar) (b'Myl\xe8ne Farmer - Anamorphosee (Japan Edition) 1995 [02/41] Back.jpg yEnc (1/3)') but has been decoded as UTF-8 with surrogateescape passed as the errors parameter. 3.2 Docs 6.6. codecs Codec registry and base classes Possible values for errors are 'surrogateescape': replace with surrogate U+DCxx, see PEP 383 Yes, it would have been 0xE8 - Mylène Googling on surrogateescape I can see lots of argument about unintended outcomes yikes! You can get the correct Unicode by encoding as UTF-8 with surrogateescape and then decoding as Latin-1: overview[1][0][1]['subject'].encode(utf-8, surrogateescape).decode(latin-1) -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN]VTD-XML 2.10
It is advertised as fastest tool. Have anyone done homework with it yet? On Sun, Feb 27, 2011 at 7:52 PM, pyt...@bdurham.com wrote: Jimmy, How does VTD-XML compare to XML tools in the stdlib or to 3rd party alternatives like lxml? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing js/ajax in a sandboxed environment
On Sun, Feb 27, 2011 at 10:26 AM, Rohan Malhotra yourbuddyro...@gmail.com wrote: BeautifulSoup library only fetches source of page. I need the access to DOM after js execution with url as input parameter. Any pointers? I am not sure but in case you need to make some ajax requests mechanize might help. http://wwwsearch.sourceforge.net/mechanize/ Please share the experience of what finally worked for you. -- A-M-I-T S|S -- http://mail.python.org/mailman/listinfo/python-list
urlopen returns forbidden
I have a working urlopen routine which opens a url, parses it for a tags and prints out the links in the page. On some sites, wikipedia for instance, i get a HTTP error 403, forbidden. What is the difference in accessing the site through a web browser and opening/reading the URL with python urllib2.urlopen? -- http://mail.python.org/mailman/listinfo/python-list
Re: urlopen returns forbidden
On Sun, Feb 27, 2011 at 9:38 PM, monkeys paw mon...@joemoney.net wrote: I have a working urlopen routine which opens a url, parses it for a tags and prints out the links in the page. On some sites, wikipedia for instance, i get a HTTP error 403, forbidden. What is the difference in accessing the site through a web browser and opening/reading the URL with python urllib2.urlopen? The User-Agent header (http://en.wikipedia.org/wiki/User_agent ). By default, the URLopener class sends a User-Agent header of urllib/VVV, where VVV is the urllib version number. – http://docs.python.org/library/urllib.html Some sites block obvious non-search-engine bots based on their HTTP User-Agent header value. You can override the urllib default: http://docs.python.org/library/urllib.html#urllib.URLopener.version Sidenote: Wikipedia has a proper API for programmatic browsing, likely hence why it's blocking your program. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
[issue11332] Increase logging/__init__.py coverage to 97%
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: OK, but acceptance tests do not need to not try to get higher test coverage. For instance, for testing disable() simply using it and making sure the outcome is as expected also works. I can understand wanting to avoid some low-level whitebox testing, but I don't think that precludes getting better coverage results. Well then, it sounds like we're on the same page. I'm not arguing against better coverage, just against the low-level whitebox testing elements of Oliver's patch. He did welcome comments, after all :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11332 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11344] Add height argument to os.path.dirname()
New submission from blokeley bloke...@gmail.com: It is a common need to find the grandparent or great-grandparent (etc.) of a given directory, which results in this: from os.path import dirname mydir = dirname(dirname(dirname(path))) Could a height parameter be added to os.path.dirname so it becomes: def dirname(path, height=1): Then we could have usage like: path = '/ggparent/gparent/parent/myfile.txt' from os.path import dirname dirname(path) /ggparent/gparent/parent dirname(path, 2) /ggparent/gparent dirname(path, 3) /ggparent Perhaps we should throw ValueErrors for invalid height values: dirname(path, 10) ValueError dirname(path, -1) ValueError Perhaps a height of 0 should do nothing: dirname(path, 0) /ggparent/gparent/parent/myfile.txt I can supply patches, unit tests and docs if you like. -- components: Library (Lib) messages: 129616 nosy: blokeley priority: normal severity: normal status: open title: Add height argument to os.path.dirname() type: feature request versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7833] Bdist_wininst installers fail to load extensions built with Issue4120 patch
Christoph Gohlke cgoh...@uci.edu added the comment: Actually, PyQt4 was not a good example since it is not build using distutils. Pywin32 and wxPython extensions are the only ones on my system specifying a dependency on Common Controls or MFC. No dependencies other than CRT, MFC, and Common Controls are specified in any assemblies of over 1000 pyd and dll files in my Python27 directory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7833 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10880] do_mkvalue and 'boolean'
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: This test is wrong:: if (!PyBool_Check(test_var) test_var == Py_False) the second part is never executed. if (test_var != Py_False) is enough to test the return value. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10880] do_mkvalue and 'boolean'
Yuriy iro...@mail.ru added the comment: +test_var = Py_BuildValue(?, 0); +if (PyBool_Check(test_var) test_var == Py_True) { +PyErr_SetString(TestError, Failed to Create boolean); +return NULL; +} + +test_var = Py_BuildValue(?, 1); +if (PyBool_Check(test_var) test_var == Py_False) { +PyErr_SetString(TestError, Failed to Create boolean); +return NULL; +} -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11256] inspect.getcallargs raises TypeError on valid arguments
Daniel Urban urban.dani...@gmail.com added the comment: I found another case, when this is a problem: if there are no **kwargs, but there are some keyword-only arguments: def f(*, a, b): pass ... f(a=1, b=2) getcallargs(f, a=1, b=2) Traceback (most recent call last): ... TypeError: f() takes no arguments (2 given) The attached issue11256_3.diff patch also fixes this problem, and adds tests that would have detected this case. -- Added file: http://bugs.python.org/file20930/issue11256_3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11256 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10880] do_mkvalue and 'boolean'
Yuriy iro...@mail.ru added the comment: sorry ^_^ +test_var = Py_BuildValue(?, 0); +if (!PyBool_Check(test_var) || test_var == Py_True) { +PyErr_SetString(TestError, Failed to Create boolean); +return NULL; +} + +test_var = Py_BuildValue(?, 1); +if (!PyBool_Check(test_var) || test_var == Py_False) { +PyErr_SetString(TestError, Failed to Create boolean); +return NULL; +} -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11321] 9th import of module _pickle always crashes
Nick Coghlan ncogh...@gmail.com added the comment: I can definitely confirm that one: ~/devel/py3k$ gcc -I/usr/local/include/python3.3m -o issue11321 issue11321.c -L/usr/local/lib/python3.3 -lpython3.3m -lm -lpthread -ldl -lutil -rdynamic ~/devel/py3k$ ./issue11321 START Try import #0 ...SUCCESS Try import #1 ...SUCCESS Try import #2 ...SUCCESS Try import #3 ...SUCCESS Try import #4 ...SUCCESS Try import #5 ...SUCCESS Try import #6 ...SUCCESS Try import #7 ...SUCCESS Segmentation fault I can also confirm that it isn't a regression w.r.t 3.1: ~/devel/py3k$ gcc -I/usr/include/python3.1 -o issue11321 issue11321.c -L/usr/lib/python3.1 -lpython3.1 -lm -lpthread -ldl -lutil -rdynamic ~/devel/py3k$ ./issue11321 START Try import #0 ...SUCCESS Try import #1 ...SUCCESS Try import #2 ...SUCCESS Try import #3 ...SUCCESS Try import #4 ...SUCCESS Try import #5 ...SUCCESS Try import #6 ...SUCCESS Try import #7 ...SUCCESS Segmentation fault It *is*, however, a regression from the 2.x line (where, presumably, cPickle simply never got reinitialised) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11321] 9th import of module _pickle always crashes
Nick Coghlan ncogh...@gmail.com added the comment: I haven't worked out where the error is happening yet, but the 13 allocated static variables and the complete lack of a module cleanup function aren't going to be helping matters. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11321] 9th import of module _pickle always crashes
Nick Coghlan ncogh...@gmail.com added the comment: Here's a sample stack trace of it blowing up: Program received signal SIGSEGV, Segmentation fault. 0x00479404 in type_dealloc (type=0x76a82f20) at Objects/typeobject.c:2523 2523_PyObject_GC_UNTRACK(type); (gdb) bt #0 0x00479404 in type_dealloc (type=0x76a82f20) at Objects/typeobject.c:2523 #1 0x00465a2b in dict_dealloc (mp=0x8f61b0) at Objects/dictobject.c:1020 #2 0x004e43c8 in _PyImport_FixupExtensionUnicode (mod=0x77f68ef0, name=0x7fffcd40 _pickle, filename=0x77f12570) at Python/import.c:611 #3 0x004e7fcf in _PyImport_LoadDynamicModule (name=0x7fffcd40 _pickle, pathname=0x7fffbc70 /usr/local/lib/python3.3/lib-dynload/_pickle.cpython-33m.so, fp=value optimised out) at ./Python/importdl.c:85 #4 0x004e5f79 in import_submodule (mod=0x796b20, subname=0x7fffcd40 _pickle, fullname=0x7fffcd40 _pickle) at Python/import.c:2894 #5 0x004e61ef in load_next (mod=0x796b20, altmod=value optimised out, p_name=value optimised out, buf=0x7fffcd40 _pickle, p_buflen=0x7fffcd38) at Python/import.c:2706 #6 0x004e6931 in import_module_level (name=0x0, globals=0x922060, locals=value optimised out, fromlist=0x796b20, level=value optimised out) at Python/import.c:2422 #7 0x004e6e74 in PyImport_ImportModuleLevel (name=0x77e6c550 _pickle, globals=0x922060, locals=0x922060, fromlist=0x796b20, level=value optimised out) at Python/import.c:2474 #8 0x004c642b in builtin___import__ (self=value optimised out, args=value optimised out, kwds=value optimised out) at Python/bltinmodule.c:167 #9 0x0042c897 in PyObject_Call (func=0x77edf8c0, arg=0x8e79e0, kw=0xa2e79) at Objects/abstract.c:2149 #10 0x004c6c73 in PyEval_CallObjectWithKeywords (func=0x77edf8c0, arg=0x77e85ef0, kw=0xa2e79) at Python/ceval.c:3739 #11 0x004ca6de in PyEval_EvalFrameEx (f=0xae4490, throwflag=value optimised out) at Python/ceval.c:2316 #12 0x004cf343 in PyEval_EvalCodeEx (_co=0x77ea5690, globals=value optimised out, locals=value optimised out, args=0x0, argcount=value optimised out, kws=value optimised out, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:3295 #13 0x004cf5db in PyEval_EvalCode (co=0x76a82f20, globals=0x8e79e0, locals=0xa2e79) at Python/ceval.c:761 #14 0x00419c7e in run_mod (command=value optimised out, flags=value optimised out) at Python/pythonrun.c:1769 #15 PyRun_StringFlags (command=value optimised out, flags=value optimised out) at Python/pythonrun.c:1703 #16 PyRun_SimpleStringFlags (command=value optimised out, flags=value optimised out) at Python/pythonrun.c:1276 #17 0x00415c41 in main () So _pickle itself doesn't seem to be dying, but it is eventually leaving things in a bad state so that the *next* time around, the import machinery blows up. Note that switching to a different module (e.g. _struct) eliminates the segfault. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11333] Add empty __slots__ to collections.abc abstract base classes
Nick Coghlan ncogh...@gmail.com added the comment: I like the idea, and it seems to work as expected (i.e. an empty __slots__ doesn't conflict with inheritance from a C defined type or a type with non-empty __slots__). However, __slots__ is one of the sections of the type machinery I'm least familiar with, so hopefully Guido will weigh in. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11333 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11321] 9th import of module _pickle always crashes
Andreas Stührk andy-pyt...@hammerhartes.de added the comment: It's because the _pickle module doesn't incref Pickler_Type and Unpickler_Type before calling `PyModule_AddObject()` (which steals a reference). The attached patch fixes the issue. -- keywords: +patch nosy: +Trundle Added file: http://bugs.python.org/file20931/issue11321.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11258] ctypes: Speed up find_library() on Linux by 500%
Jonas H. jo...@lophus.org added the comment: Humm. Would be great to have the `ldconfig -p` output of such a machine... I can't get ldconfig to recognize 64-bit libraries on my 32-bit machines, so I have no output to test against... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11258 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11329] PyEval_InitThreads() not safe before Py_Initialize()
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11329] PyEval_InitThreads() not safe before Py_Initialize()
STINNER Victor victor.stin...@haypocalc.com added the comment: Can you write a patch for the documentation? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11345] Fix a link in library/json docs
New submission from Jonas H. jo...@lophus.org: I guess this should be a link. -- assignee: docs@python components: Documentation files: fix-json-link.diff keywords: patch messages: 129629 nosy: docs@python, jonash priority: normal severity: normal status: open title: Fix a link in library/json docs versions: Python 3.3 Added file: http://bugs.python.org/file20932/fix-json-link.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11345 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11258] ctypes: Speed up find_library() on Linux by 500%
Antoine Pitrou pit...@free.fr added the comment: Here is an excerpt: libc.so.6 (libc6,x86-64, OS ABI: Linux 2.6.9) = /lib64/libc.so.6 libc.so.6 (libc6, OS ABI: Linux 2.6.9) = /lib/libc.so.6 The OS ABI thing is not always there: libdrm.so.2 (libc6,x86-64) = /usr/lib64/libdrm.so.2 libdrm.so.2 (libc6) = /usr/lib/libdrm.so.2 As you see, there are two of them with the same name but in a different path. If you return the absolute path, there is a 50% possibility that you are returning the wrong one ;) There seem to be two key differences between the original implementation and yours: - the orig impl matches the abi_type at the beginning of the parentheses, yours simply ignores the abi_type (that should have caught my eye, but that regex looked so much like magic that I didn't try to make sense of it :-)) - the orig impl returns the file name from the beginning of the matched line, yours returns the full path from the end of the line I guess it should be doable to retain the speed benefit while implementing a matching algorithm closer to the original one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11258 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11346] Generator object should be mentioned in gc module document
New submission from Atsuo Ishimoto ishim...@gembook.org: In the gc.garbage of the library ref of gc module, ... this list contains only objects with __del__() methods. This is not true, since gc.garbage will contain generator object with try-finally block. -- assignee: docs@python components: Documentation messages: 129631 nosy: docs@python, ishimoto priority: normal severity: normal status: open title: Generator object should be mentioned in gc module document ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11346 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper
Éric Araujo mer...@netwok.org added the comment: Does the attached patch fix the issue? -- assignee: tarek - eric.araujo components: +Distutils2 keywords: +patch nosy: +alexis versions: +3rd party, Python 2.7, Python 3.1, Python 3.3 Added file: http://bugs.python.org/file20933/distutils-files.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11314] Subprocess suffers 40% process creation overhead penalty
Charles-Francois Natali neolo...@free.fr added the comment: Aaron Sherman a...@ajs.com added the comment: That's why I asked for absolute numbers for the overhead difference. Did you not follow the link in my first post? I got pretty detailed, there. By the way, strace has a '-T' flag that can be used to measure the time spent in syscalls (but for a mmap/mremap/munmap it won't be significant). However, I do think that doing the performance testing before deprecating the previous interface would have been a good idea... Once again: subprocess.Popen is actually faster than os.pipe to create a subprocess. Just don't pass shell=True. Unless you're spawning shell scripts, but in that case subprocess' overhead is definitely not biggest problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11345] Fix a link in library/json docs
Benjamin Peterson benja...@python.org added the comment: r88668 -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11345 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11344] Add height argument to os.path.dirname()
R. David Murray rdmur...@bitdance.com added the comment: I'm -1 on this feature request. I think it is an unnecessary complication of the API, especially since dirname corresponds to the unix shell 'dirname' command, which doesn't have such a feature. If you need this feature in a particular application, it is easy to write a function to provide it. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11344] Add height argument to os.path.dirname()
Antoine Pitrou pit...@free.fr added the comment: Well, on the other hand, it *is* a common need. (and I don't think mimicking the shell is a design principle for Python) -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4600] __class__ assignment: new-style? heap? == confusing
Changes by Daniel Stutzbach stutzb...@google.com: -- nosy: +stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4600 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper
Andreas Stührk andy-pyt...@hammerhartes.de added the comment: @Éric: You should probably strip the colour from your diff :-) -- nosy: +Trundle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4600] __class__ assignment: new-style? heap? == confusing
Changes by Andreas Stührk andy-pyt...@hammerhartes.de: -- nosy: +Trundle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4600 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper
Changes by Éric Araujo mer...@netwok.org: Removed file: http://bugs.python.org/file20933/distutils-files.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper
Changes by Éric Araujo mer...@netwok.org: Added file: http://bugs.python.org/file20934/distutils-files.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11258] ctypes: Speed up find_library() on Linux by 500%
Jonas H. jo...@lophus.org added the comment: the orig impl matches the abi_type at the beginning of the parentheses, yours simply ignores the abi_type (that should have caught my eye, but that regex looked so much like magic that I didn't try to make sense of it :-)) Same here. :) The version I attached seems to work for me. It's some kind of compromise -- basically it's the original regex but with the unneccessary, performance-decreasing cruft stripped away. btw, Jonas H. is perfectly fine - I don't care about being honored, I just want to `import uuid` without waiting forever. :-) -- Added file: http://bugs.python.org/file20935/faster-find-library1-py3k-with-escaped-name-try2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11258 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11282] 3.3 unittest document not kept consist with code
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11282 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError
Filip Gruszczyński grusz...@gmail.com added the comment: Test for releasing unacquired lock and aliasing exception. -- keywords: +patch nosy: +gruszczy Added file: http://bugs.python.org/file20936/11140.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11140 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11344] Add height argument to os.path.dirname()
R. David Murray rdmur...@bitdance.com added the comment: No, it isn't a design principle. My point was that unix hasn't found it useful to add a level option to the dirname API. I don't know that I personally have ever had occasion to peel off more than one directory level without also wanting to do something with the intermediate results, so perhaps I am not a good judge of how useful this would be. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11333] Add empty __slots__ to collections.abc abstract base classes
Guido van Rossum gu...@python.org added the comment: I think the idea is reasonable. (I haven't checked the patch.) -- assignee: gvanrossum - ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11333 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4600] __class__ assignment: new-style? heap? == confusing
Jonas H. jo...@lophus.org added the comment: Here comes a patch, changing the behaviour to: ./python -q class C: ... pass ... (1).__class__ = 1 Traceback (most recent call last): File stdin, line 1, in module TypeError: __class__ must be set to a class defined by a class statement, not 'int' object (1).__class__ = object Traceback (most recent call last): File stdin, line 1, in module TypeError: class__ must be set to a class defined by a class statement, not 'object' (1).__class__ = C Traceback (most recent call last): File stdin, line 1, in module TypeError: __class__ assignment: only for instances of classes defined by class statements -- keywords: +patch nosy: +jonash Added file: http://bugs.python.org/file20937/4600.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4600 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9931] test_ttk_guionly hangs on XP5
Antoine Pitrou pit...@free.fr added the comment: Ok, great ! The hg builders are temporary - or, rather, the SVN builders will get removed once the transition is over. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9931 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10880] do_mkvalue and 'boolean'
Dj Gilcrease digitalx...@gmail.com added the comment: Correct the tests. They passed before but had a logic flaw that caused them to never test that the correct boolean value was being returned. -- Added file: http://bugs.python.org/file20938/issue10880_68064.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10880] do_mkvalue and 'boolean'
Changes by Dj Gilcrease digitalx...@gmail.com: Removed file: http://bugs.python.org/file20929/issue10880_rev68064.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4600] __class__ assignment: new-style? heap? == confusing
Benjamin Peterson benja...@python.org added the comment: This is not really accurate: class x(int): pass ... class y(object): pass ... x().__class__ = y Traceback (most recent call last): File stdin, line 1, in module TypeError: __class__ assignment: 'x' object layout differs from 'y' y().__class__ = x Traceback (most recent call last): File stdin, line 1, in module TypeError: __class__ assignment: 'y' object layout differs from 'x' -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4600 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0
Ezio Melotti ezio.melo...@gmail.com added the comment: The patch turned out to be less trivial than I initially thought. The current algorithm checks for invalid continuation bytes in 4 places: 1) before the switch/case statement in Objects/unicodeobject.c when it checks if there are enough bytes in the string (e.g. if the current byte is a start byte of a 4-bytes sequence and there are only 2 more bytes in the string, the sequence is invalid); 2) in the case 2 of the switch, where it's checked if the second byte is a valid continuation byte; 3) in the case 3 of the switch, where it's checked if the second and third bytes are valid continuation bytes, including additional invalid cases for the second bytes; 3) in the case 4 of the switch, where it's checked if the second, third, and fourth bytes are valid continuation bytes, including additional invalid cases for the second bytes; The correct algorithm should determine the maximum valid subpart of the sequence determining the position of the first invalid continuation byte. Continuation bytes are all in range 80..BF except for the second byte of 3-bytes sequences that start with E0 or ED and second byte of 4-bytes sequences that start with F0 or F4 (3rd and 4th continuation bytes are always in range 80..BF). This means that the above 4 cases should be changed in this way: 1) if there aren't enough bytes left to complete the sequence check for valid continuation bytes considering the special cases for the second bytes (E0, ED, F0, F4) instead of using the naive algorithm that checks only for continuation bytes in range 80..BF; 2) the case 2 is fine as is, because the second byte is always in range 80..BF; 3) the case 3 should check (pseudocode): if (second_byte_is_not_valid) max_subpart_len = 1 else if (third_byte not in 80..BF) max_subpart_len = 2 else # the sequence is valid the second_byte_is_not_valid part should consider the two special cases for E0 and ED. 4) the case 4 should check (pseudocode): if (second_byte_is_not_valid) max_subpart_len = 1 else if (third_byte not in 80..BF) max_subpart_len = 2 else if (fourth_byte not in 80..BF) max_subpart_len = 3 else # the sequence is valid here the second_byte_is_not_valid part should consider the two special cases for F0 and E4. In order to avoid duplication of code I was thinking to add 2 macros (something like IS_VALID_3_SEQ_2ND_BYTE, IS_VALID_4_SEQ_2ND_BYTE) that will be used in the cases 1) and 3), and 1) and 4) respectively. The change shouldn't affect the decoding speed, but it will increase the lines of code and complexity of the function. Is this OK? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11332] Increase logging/__init__.py coverage to 97%
Oliver Drake obdrak...@gmail.com added the comment: Thanks for the comments and prompt response :) I think I misunderstood the nature and level of these unit tests. I will fix the specific issues you mentioned, and either cut or modify the less useful/too low level tests (e.g. disable). In general I will change my approach to be more high level. I will steer away from testing the implementation line by line, but I believe there should be unit tests that enforce the API that is published to the user - i.e. one unit test for every class, method and function, testing inputs, outputs, exception handling and general behavior. So if a developer changes the API or the general behavior of a function he/she should have to change the documentation and the appropriate unit test - or do we want to avoid this type of testing completely? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11332 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11347] libpython3.so: Broken soname and linking
New submission from Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: 1. libpython3.so has soname llibpython3.so due to needless l in -Wl,-hl$@. 2. libpython3.so is not linked against libpython$(LDVERSION).so when -Wl,--as-needed flag is used. -Wl,--as-needed flag is used by default in Gentoo due to major benefits. From `info ld`: `--as-needed' `--no-as-needed' This option affects ELF DT_NEEDED tags for dynamic libraries mentioned on the command line after the `--as-needed' option. Normally the linker will add a DT_NEEDED tag for each dynamic library mentioned on the command line, regardless of whether the library is actually needed or not. `--as-needed' causes a DT_NEEDED tag to only be emitted for a library that satisfies an undefined symbol reference from a regular object file or, if the library is not found in the DT_NEEDED lists of other libraries linked up to that point, an undefined symbol reference from another dynamic library. `--no-as-needed' restores the default behaviour. I'm attaching the patch. -- components: Build files: libpython3.so.patch keywords: patch messages: 129649 nosy: Arfrever, loewis priority: normal severity: normal status: open title: libpython3.so: Broken soname and linking versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file20939/libpython3.so.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11347] libpython3.so: Broken soname and linking
Changes by Georg Brandl ge...@python.org: -- assignee: - loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11332] Increase logging/__init__.py coverage to 97%
Brett Cannon br...@python.org added the comment: Testing the documented API is definitely wanted, Oliver. Any change in behaviour needs to be detected to ensure there is not backwards-compatibility regressions without it being intentional. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11332 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11340] test_distutils fails
Brett Cannon br...@python.org added the comment: Can you provide the test's failing report and traceback? -- nosy: +brett.cannon status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11340 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11347] libpython3.so: Broken soname and linking
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: Regardless of this patch, such a libpython3.so regular file cannot exist in Gentoo. Gentoo package manager disallows installation, when it detects file collisions. If I rename libpython3.so of Python 3.2 to libpython3-3.2.so and libpython3.so of Python 3.3 to libpython3-3.3.so, then ldconfig will create libpython3.so symlink pointing to potentially wrong target library. This problem can be avoided by removing soname from libpython3.so, so whole -Wl,-h${soname} could be removed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11340] test_distutils fails
Brett Cannon br...@python.org added the comment: My mistake; missed the attachment. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11340 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11348] test_os: test_set_get_priority() fails when high niceness is set
New submission from Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: $ nice -n20 python3.3 -m test.test_os ... test_set_get_priority (__main__.ProgramPriorityTests) ... FAIL == FAIL: test_set_get_priority (__main__.ProgramPriorityTests) -- Traceback (most recent call last): File /usr/lib64/python3.3/test/test_os.py, line 1280, in test_set_get_priority self.assertEqual(os.getpriority(os.PRIO_PROCESS, os.getpid()), base + 1) AssertionError: 19 != 20 -- components: Tests messages: 129654 nosy: Arfrever, giampaolo.rodola priority: normal severity: normal status: open title: test_os: test_set_get_priority() fails when high niceness is set versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11348 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11348] test_os: test_set_get_priority() fails when high niceness is set
Giampaolo Rodola' g.rod...@gmail.com added the comment: Of course the test fails: a process can't have a nice value higher than a certain limit, which I think can vary depending on the UNIX variant in use. The fix is not to use nice -n20. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11348 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This would be an important fix-up if we could find some way to implement it. The basic problem is that the class object is defined after the class definitions have been made, so the target of the Graph reference isn't known when the method definitions are being compiled. One approach to solving this problem is to use a deferred/resolved pattern (creating a valid reference to Graph that is visible during method compilation, but gets filled-in with the other methods afterwards). I haven't thought this through completely but think it could be done if we let the compiler write to the class dictionary (this is normally off-limits and protected by a dict_proxy). If we let the system punch a hole in the proxy, it is possible to resolve deferred class definitions. Here's a concept sketch: class Prepared(type): 'Preload the class with a reference to itself' @classmethod def __prepare__(mcl, name, bases): return {name: type(name, bases, {})} def __new__(mcl, name, bases, mapping): global deferred_class tmpcls = super().__new__(mcl, name, bases, mapping) deferred_class = mapping[name] deferred_class.__dict__.update(tmpcls.__dict__) # XXX need writeable dict_proxy return deferred_class class Graph(metaclass=Prepared): def reverse(self) - Graph: ... -- nosy: +arigo, rhettinger, stutzbach resolution: rejected - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- Removed message: http://bugs.python.org/msg129656 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This would be an important fix-up if we could find some way to implement it. The basic problem is that the class object is defined after the class definitions have been made, so the target of the Graph reference isn't known when the method definitions are being compiled. One approach to solving this problem is to use a deferred/resolved pattern (creating a valid reference to Graph that is visible during method compilation, but gets filled-in with the other methods afterwards). I haven't thought this through completely but think it could be done if we let the compiler write to the class dictionary (this is normally off-limits and protected by a dict_proxy). If we let the system punch a hole in the proxy, it is possible to resolve deferred class definitions. Here's a concept sketch: class Prepared(type): 'Preload the class with a reference to itself' @classmethod def __prepare__(mcl, name, bases): return {name: type(name, bases, {})} def __new__(mcl, name, bases, mapping): tmpcls = super().__new__(mcl, name, bases, mapping) deferred_class = mapping[name] deferred_class.__dict__.update(tmpcls.__dict__) # XXX need writeable dict_proxy return deferred_class class Graph(metaclass=Prepared): -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11348] test_os: test_set_get_priority() fails when high niceness is set
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: I actually wanted to use 'nice -n19 python3.3 -m test.test_os', which also fails. Test suite of Python can be run be a package manager, which automatically sets high niceness. If niceness is high, then maybe this test could try to decrease it instead of increasing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11348 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com