Re: Database access benchmarks for use in web-frameworks - How does Python compare?
I suggest that the use of dynamical page forwarding to different severs which run the same software package. This can be done in python! -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
On Thu, 03 Nov 2011 17:54:52 +, Andrea Crotti wrote: All these ideas (shell and git hooks) are nice, but unfortunately - it's svn not git - it's windows not *nix - we have to remove only the ones without the corresponding *py... Does it matter? The other .pyc files will be recreated when they are next needed. Just nuke all the .pyc files and be done with it. Or if you can't bear having to wait for Python to compile them as needed, you can force compilation by running your test suite (you do have a test suite, don't you?) or by using the compileall.py script. python -m compileall some_directory should do the trick. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes: catch system exit from C library
On Thu, 03 Nov 2011 14:16:50 +, Grant Edwards wrote: in my python application I am calling functions from a C library via `ctypes` interface. Some fns from that C library calls `exit()` on error. Just curious, which library is that? I'm reasonably sure that he's talking about the GRASS libraries. In which, the standard error-handling mechanism is to call G_fatal_error(), which ultimately calls exit(). AKA the samurai principle: return victorious, or don't return at all. [FWIW, re-writing everying in C++ and using exceptions is not a realistic option]. And who should we have thrashed and pilloried for writing it that way? No-one. It's a perfectly rational design given the context. GRASS consists of ~350 command-line programs (modules) in the traditional Unix style (read command-line arguments, do processing, terminate). The libraries exist to support the creation of such modules, and are fit for that particular purpose. Handling errors by having status codes which propagate up the call chain would add a significant amount of code. More importantly, it would push the burden of handling errors onto the authors of the various modules (and historical evidence suggests that checking for (let alone handling) errors is unlikely to occur). The mechanism works fine, so long as you don't try to use the libraries for purposes for which they weren't designed (e.g. long-running programs such as interactive applications or servers). As the story goes ... Patient: Doctor, when I do this ... it hurts Doctor: Well don't do it then! -- http://mail.python.org/mailman/listinfo/python-list
Re: Database access benchmarks for use in web-frameworks - How does Python compare?
Alec Taylor, 03.11.2011 11:19: I'm building a large e-commerce site, and it is very important that what I write can: - Handle larger server load - Deliver pages quickly - Make transactions quickly Those are pretty broad requirements. If a framework can satisfy them or not depends more on how you set it up and deploy it (e.g. how many servers you run, what kind of load balancing you use, how you serve your static content, etc.) than the actual framework you choose, I'd say. as well as have a small development time (i.e. pre-built modules for e-commerce are available, and extendible). e-commerce is also a very broad term. But I'd expect that any of the recent web frameworks (certainly including Django) will satisfy your needs in some way. Are there recent accessible statistics available, comparing these metrics across the most popular web-frameworks? (i.e. Symfony, DJango, Rails, ASP.NETetc) Not that I know of. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
I like to install a Bash shell of some kind on windows boxes I work on, specifically so I can use shell commands like this, just like on any other operating system. Cywin works just fine for this. svn also has hooks, but sadly not a checkout hook: http://svnbook.red-bean.com/en/1.1/ch05s02.html I guess you could write your own two-line wrapper script which does the checkout and then deletes the pyc files. I don't understand why deleting only some pyc files is important. Can't you just delete them all and let Python re generate the ones you need? I once saw someone create the longest python file they could to see how long generating pyc files takes, and it is very very quick indeed. A human could not notice the delay even for the largest of projects. Finally, someone asked about skipping .svn dirs: find has a '-prune' option, you can read about it on the manpage. -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
Apologies for all my messasges appearing twice. I'm using google groups web ui and have no idea why it's doing that. I'll stop using it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
Am 04.11.2011 01:33, schrieb Anthony Kong: I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? My consensus with myself is that design patterns are language-agnostic. If I write class Foo serves as view and controller for class Bar in a model-view-controller (MVC) design, everybody that knows MVC has immediately a very high-level understanding of how those two classes interact. I am doing some 'fact-finding' in this area on request of my colleagues. Some of them want to buy a book or two in this subject area. Hopefully the newsgroup can give me some book recommendation and insight in this topic. The Gang of Four book on design patterns is one you will probably come across, and there are many that refer to it. I myself pretty much subscribe to the view that the nature of python language actually do away much of the need of the use of DP, but it is just a personal view. It comes form my experience of migrating from webware4py (webframework based on J2EE/servlet idea) to cherrypy webframework based on J2EE/servlet - apart from J2EE being a specific implementation, this also describes a design pattern, i.e. one where (forgive me if I'm slightly off, this is not actually my field of programming) the UI is browser-based and the program logic runs on a server. Instead of explaining it in many words, you reused the known design pattern to describe it, and that is also IMHO what design patterns are about. They serve as a tool to make software that follows known patterns, so that people that know the pattern will recognize them and then get easier understanding. It also serves as tool when talking about things, you don't have to explain the design when you can refer to a pattern. In that sense, I fully disagree that design patterns are obsolete in Python. However, there are other patterns that are more language-specific, like e.g. RAII in C++, so if you rather meant those, I would agree with you. Cheers! Uli -- http://mail.python.org/mailman/listinfo/python-list
Re: Dictionary sorting
Ben Finney ben+pyt...@benfinney.id.au writes: Tim Chase python.l...@tim.thechases.com writes: On 11/03/11 16:36, Terry Reedy wrote: CPython iterates (and prints) dict items in their arbitrary internal hash table order, which depends on the number and entry order of the items. It is a bug to depend on that arbitrary order in any way. Does this never trust it hold even for two consecutive iterations over an unchanged dict? I didn't see anything in the docs[1] to make such a claim, Exactly. This is false. The docs say: If items(), keys(), values(), iteritems(), iterkeys(), and itervalues() are called with no intervening modifications to the dictionary, the lists will directly correspond. This allows the creation of (value, key) pairs using zip(): pairs = zip(d.values(), d.keys()). (http://docs.python.org/library/stdtypes.html#mapping-types-dict) The order of retrieval is entirely up to the implementation. This part is still true, but the order won't change behind your back if you're not touching the dict. -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
On 11/04/2011 09:27 AM, Jonathan Hartley wrote: I like to install a Bash shell of some kind on windows boxes I work on, specifically so I can use shell commands like this, just like on any other operating system. Cywin works just fine for this. svn also has hooks, but sadly not a checkout hook: http://svnbook.red-bean.com/en/1.1/ch05s02.html I guess you could write your own two-line wrapper script which does the checkout and then deletes the pyc files. I don't understand why deleting only some pyc files is important. Can't you just delete them all and let Python re generate the ones you need? I once saw someone create the longest python file they could to see how long generating pyc files takes, and it is very very quick indeed. A human could not notice the delay even for the largest of projects. Finally, someone asked about skipping .svn dirs: find has a '-prune' option, you can read about it on the manpa Uhm yes it makes sense also to just remove all of them, I don't know why it was done like this but probably for performance reasons. I will try both ways, but I would definitively avoid the shell scripting, because it's mainly windows but it has to be multi-platform.. -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
On Fri, Nov 4, 2011 at 9:34 PM, Andrea Crotti andrea.crott...@gmail.com wrote: Uhm yes it makes sense also to just remove all of them, I don't know why it was done like this but probably for performance reasons. I will try both ways, but I would definitively avoid the shell scripting, because it's mainly windows but it has to be multi-platform.. If you're removing them all, you don't need to use a powerful shell. Much much easier! Just recursively del *.pyc and you're done. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: SystemError when defining
On 11/3/11, Chris Angelico ros...@gmail.com wrote: Fascinating! Awesome to know! I did some introspection with this: *snip* Variations on the theme show that during compilation of foo, the name is normally cemented as either a global or a local - but if it's keyword-only, then a LOAD_NAME opcode is emitted. It's the code for LOAD_NAME that looks for locals, which presumably a lambda doesn't have. What is the LOAD_NAME for? The non-keyword default doesn't seem to need it. -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
On 11/04/2011 10:39 AM, Chris Angelico wrote: If you're removing them all, you don't need to use a powerful shell. Much much easier! Just recursively del *.pyc and you're done. ChrisA Discussing with the guy that did it I think it's actually a good idea instead, because removing them *all* means. - remove a few thousand files every time where maybe 0 would be removed otherwise - recompile the same thousand of files It might not be so relevant but for 10 lines of code more I guess it's fine.. -- http://mail.python.org/mailman/listinfo/python-list
python-based downloader (youtube-dl) missing critical feature ...
python-based youtube-dl ~ http://rg3.github.com/youtube-dl/ ~ is sorely missing a flag in order to indicate the maximum file length of the data feed it would download (well, unless, for some reason, it is considered a feature). ~ I wonder what developers were thinking about when they came up this nice piece of code. If you actually look in the code ~ ... data = urllib2.urlopen(basic_request) content_length = data.info()['Content-Length'] ... ~ you will see they get the content length of the actual data feed and they also print the progress status based on the content length ~ Implementing an if statement a la: ~ max_indicated_content_length = self.params.get('max_content_length', None); ~ if( content_length max_indicated_content_length ){ [do not download, just report data feed too large] } else{ [do] } ~ shouldn't be hard at all ~ youtube-dl is under the Creative Commons License copyrighted by 2006-2011 Ricardo Garcia Gonzalez and maintained by him and a group of python developers ~ They are the ones keeping a mental map of that project. It would be a plus if they implement this feature, but anyother python developer can implemented (please, let me know if/when you do) ~ lbrtchx -- http://mail.python.org/mailman/listinfo/python-list
Re: Dictionary sorting
Hrvoje Niksic hnik...@xemacs.org writes: Ben Finney ben+pyt...@benfinney.id.au writes: Tim Chase python.l...@tim.thechases.com writes: Does this never trust it hold even for two consecutive iterations over an unchanged dict? I didn't see anything in the docs[1] to make such a claim, Exactly. This is false. The docs say: If items(), keys(), values(), iteritems(), iterkeys(), and itervalues() are called with no intervening modifications to the dictionary, the lists will directly correspond. This allows the creation of (value, key) pairs using zip(): pairs = zip(d.values(), d.keys()). (http://docs.python.org/library/stdtypes.html#mapping-types-dict) Thank you for this correction. -- \ “Firmness in decision is often merely a form of stupidity. It | `\indicates an inability to think the same thing out twice.” | _o__)—Henry L. Mencken | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
On Nov 3, 6:33 pm, Anthony Kong anthony.hw.k...@gmail.com wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some 'fact-finding' in this area on request of my colleagues. Some of them want to buy a book or two in this subject area. Hopefully the newsgroup can give me some book recommendation and insight in this topic. I myself pretty much subscribe to the view that the nature of python language actually do away much of the need of the use of DP, but it is just a personal view. It comes form my experience of migrating from webware4py (webframework based on J2EE/servlet idea) to cherrypy I don't know of a book on design patterns in Python. I've got a couple of observations. The first is that if you use TDD (Test Driven Development) and refactor relentlessly to remove duplication, most of the basic design patterns will emerge naturally from the code as you work. The second is that, as far as I'm concerned, the utility of a design patterns book is in the discussion of what the pattern is good for, and what it isn't good for. That is, as another poster says, language agnostic. John Roth -- http://mail.python.org/mailman/listinfo/python-list
Re: python-based downloader (youtube-dl) missing critical feature ...
On Fri, 04 Nov 2011 11:48:02 +, lbrt chx _ gemale wrote: python-based youtube-dl ~ http://rg3.github.com/youtube-dl/ ~ is sorely missing a flag in order to indicate the maximum file length of the data feed it would download (well, unless, for some reason, it is considered a feature). If you are making a feature request, you should make it directly to the project developer, and not here. Since you consider that feature shouldn't be hard at all (your words), perhaps you should consider providing a patch? Don't forget the documentation and tests for it. Or did you mean it shouldn't be hard for me, if somebody else does the work? ~ I wonder what developers were thinking about when they came up this nice piece of code. If you actually look in the code [...] Lbrtchx, it's possible that English is not your natural language. Please be aware that, in English, what they were thinking... is often used sarcastically, as in they weren't actually thinking. Particularly following your use of scare quotes around feature. (Even more so for the similar form, what were they thinking?.) It's probably not going to help you get a feature added to the project if you imply (even by accident) that lack of that feature is an indication that the developer wasn't thinking. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
On Fri, Nov 4, 2011 at 8:28 AM, John Roth johnro...@gmail.com wrote: The first is that if you use TDD (Test Driven Development) and refactor relentlessly to remove duplication, most of the basic design patterns will emerge naturally from the code as you work. I agree, and there is a pretty good series of articles on developerWorks that covers this: http://www.ibm.com/developerworks/java/library/j-eaed2/index.html The author used Java in this series, but as Ulrich mentioned, I feel that design patterns (and emergent design) are language-agnostic.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
On 11/04/2011 12:33 AM, Anthony Kong wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some 'fact-finding' in this area on request of my colleagues. Some of them want to buy a book or two in this subject area. Hopefully the newsgroup can give me some book recommendation and insight in this topic. I myself pretty much subscribe to the view that the nature of python language actually do away much of the need of the use of DP, but it is just a personal view. It comes form my experience of migrating from webware4py (webframework based on J2EE/servlet idea) to cherrypy Well this book is work in progress https://bitbucket.org/BruceEckel/python-3-patterns-idioms/src but it actually looks very interesting -- http://mail.python.org/mailman/listinfo/python-list
Re: python-based downloader (youtube-dl) missing critical feature ...
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 As already said, you should file your request at https://github.com/rg3/youtube-dl/issue , not here. A few things to note: * Not all sites necessarily send the Content-Length header. * RTMP URLs would have to be treated differently * Sending a Range header might allow for a better implementation. Why do you want to restrict the filesize of the download in the first place? I can't see a use case, but that doesn't mean there isn't one. Due to me not having lots of time at the moment, your best chance to get any youtube-dl feature implemented is providing a patch (in form of a github pull-request, if possible). - -- Philipp (youtube-dl developer) l...@mail.python.org wrote: python-based youtube-dl ~ http://rg3.github.com/youtube-dl/ ~ is sorely missing a flag in order to indicate the maximum file length of the data feed it would download (well, unless, for some reason, it is considered a feature). ~ I wonder what developers were thinking about when they came up this nice piece of code. If you actually look in the code ~ ... data = urllib2.urlopen(basic_request) content_length = data.info()['Content-Length'] ... ~ you will see they get the content length of the actual data feed and they also print the progress status based on the content length ~ Implementing an if statement a la: ~ max_indicated_content_length = self.params.get('max_content_length', None); ~ if( content_length max_indicated_content_length ){ [do not download, just report data feed too large] } else{ [do] } ~ shouldn't be hard at all ~ youtube-dl is under the Creative Commons License copyrighted by 2006-2011 Ricardo Garcia Gonzalez and maintained by him and a group of python developers ~ They are the ones keeping a mental map of that project. It would be a plus if they implement this feature, but anyother python developer can implemented (please, let me know if/when you do) ~ lbrtchx -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEAREKAAYFAk6z3mMACgkQ9eq1gvr7CFyr1wCgpqf8xuORDC4LBVY8WFmtAufG k+AAoIX+mXa7SGLULP2M67IQ34sBgk1o =duyH -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: python-based downloader (youtube-dl) missing critical feature ...
Steven D'Aprano wrote: On Fri, 04 Nov 2011 11:48:02 +, lbrt chx _ gemale wrote: python-based youtube-dl ~ http://rg3.github.com/youtube-dl/ ~ is sorely missing a flag in order to indicate the maximum file length of the data feed it would download (well, unless, for some reason, it is considered a feature). If you are making a feature request, you should make it directly to the project developer, and not here. Since you consider that feature shouldn't be hard at all (your words), perhaps you should consider providing a patch? Don't forget the documentation and tests for it. Or did you mean it shouldn't be hard for me, if somebody else does the work? ~ I wonder what developers were thinking about when they came up this nice piece of code. If you actually look in the code [...] Lbrtchx, it's possible that English is not your natural language. Please be aware that, in English, what they were thinking... is often used sarcastically, as in they weren't actually thinking. Particularly following your use of scare quotes around feature. (Even more so for the similar form, what were they thinking?.) It's probably not going to help you get a feature added to the project if you imply (even by accident) that lack of that feature is an indication that the developer wasn't thinking. Maybe Lbrtchx is one of the Sheldon Cooper's nicknames :o) JM PS : I have the feeling that my nerdy reference will fall flat... -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
Uhn, thanks for the easy way Just delete all *.pyc recursively. spend another 5-20 minutes to recompile all to get everything sync.. That is trivial! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python advanced course (preferably in NA)
This was great. Thank you all! /Behnam On Nov 3, 5:18 pm, Catherine Moroney catherine.m.moro...@jpl.nasa.gov wrote: I've taken twoPythonclasses from David Beazley and can second Eric's recommendation. The advanced class is reallyadvanced and goes into some pretty mind-blowing stuff. The class comes with lots of problems and solutions, and a book of all the slides which are a great reference. Well worth the time and money! Catherine Eric Snow wrote: On Thu, Nov 3, 2011 at 12:13 PM, Behnam bkamr...@gmail.com wrote: Anybody is aware of anyadvancedcourseinPythonpreferably in north america? I've been partly coding inPythonfor couple of years now and have used PyQt. What I'd like to learn more is a kind of advance OOP in python. Any idea? While I don't know specifically, check out the following link (from thePythonsite): http://wiki.python.org/moin/PythonTraining I have taken a class each (PyCon tutorial) from Raymond Hettinger, David Beazley, and Brian Jones, and found each of them to be outstanding courses. Only David is listed on that page to which I linked, though I know Raymond does courses at least from time to time. I've also heard a talk from Wesley Chun and found him to be fantastic. -eric BTW, I'm not a computer engineer and have mechanical background. Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Line continuation issue\
Is this the right place to propose language extensions? My Python code keeps expanding rightwards, it is difficult to keep it contained within reasonable limits. But the standard line continuation \ is positively anti-Pythonic because an *invisible* white space between \ and [CR] will render it useless. How about a new Python symbol, maybe \\ that CAN have following whitespace which is ignored, so that seeing a \\ in the code forces it to continue on the next line. Has this issue been discussed already? slehar -- http://mail.python.org/mailman/listinfo/python-list
Re: Line continuation issue\
Steven Lehar wrote: Is this the right place to propose language extensions? My Python code keeps expanding rightwards, it is difficult to keep it contained within reasonable limits. You should attack this by breaking large expressions into smaller ones and factoring out some of your code into helper functions. But the standard line continuation \ is positively anti-Pythonic because an *invisible* white space between \ and [CR] will render it useless. Useless? You get a SyntaxError, remove the offending whitespace, and that's it. How about a new Python symbol, maybe \\ that CAN have following whitespace which is ignored, so that seeing a \\ in the code forces it to continue on the next line. Did you know that there already is a pythonic alternative that works well in most cases? An open (, [, or { will allow you to continue on the next line, e. g. items = [(foo(item), bar(item)) for row in rows for item in row if baz( alpha=1, beta=item)] no strings attached. -- http://mail.python.org/mailman/listinfo/python-list
Re: Line continuation issue\
On Sat, Nov 5, 2011 at 2:10 AM, Steven Lehar sle...@gmail.com wrote: But the standard line continuation \ is positively anti-Pythonic because an *invisible* white space between \ and [CR] will render it useless. How's it anti-Pythonic for invisible whitespace differences to be significant? /troll ChrisA *grinning, running, and ducking* -- http://mail.python.org/mailman/listinfo/python-list
Re: Line continuation issue\
How's it anti-Pythonic for invisible whitespace differences to be significant? A central idea of Python was to replace {curly;braces{and;parentheses;}}, which are easily overlooked by the programmer, and use WHITESPACE instead, something that is clearly visible to the programmer, as the defining syntax. Make what is visible to humans significant to the interpreter. -- http://mail.python.org/mailman/listinfo/python-list
Re: Line continuation issue\
On Sat, Nov 5, 2011 at 2:53 AM, Steven Lehar sle...@gmail.com wrote: How's it anti-Pythonic for invisible whitespace differences to be significant? A central idea of Python was to replace {curly;braces{and;parentheses;}}, which are easily overlooked by the programmer, and use WHITESPACE instead, something that is clearly visible to the programmer, as the defining syntax. Make what is visible to humans significant to the interpreter. I refer more to the problems that perpetually plagued Python programmers regarding tabs vs spaces (which I think was finally closed off only in Python 3). ChrisA -- http://mail.python.org/mailman/listinfo/python-list
short reading materials about anthropological, universal themes for students with no reading habit ...
A few things to note: * Not all sites necessarily send the Content-Length header. * RTMP URLs would have to be treated differently ~ No some don't, but at least for the ones that do (like youtube) it would be a useful feature. The Content-Length header is used in the code anyway ~ * Sending a Range header might allow for a better implementation. ~ Yes, it would ~ Why do you want to restrict the filesize of the download in the first place? I can't see a use case, but that doesn't mean there isn't one. ~ OK, I see your point. Say, you have a list of youtube urls, which feeds you want to download using a script or a playlist someone put together, but you don't want to download files that are too large, which may not be of any use to you. For example, I teach and it doesn't make any sense to use a full movie as part of a class set. So I would like for youtube-dl to let me know which files are larger than a given size (and possibly save them in a file) for me to check the files first My languages are ANSI C, C++ and java. When I was young and silly would blab girls just because they crossed my way, now I don't like to even look into anything that I don't want to invest my time in on an ongoing basis. I would let people that code python and have a mental map of that code base do it themselves lbrtchx -- http://mail.python.org/mailman/listinfo/python-list
Re: SystemError when defining
def x(nonlocal_var): ... def y(): ... z = lambda *, keyword_only=nonlocal_var: None ... return y ... x(None)() Traceback (most recent call last): File stdin, line 1, in module File stdin, line 3, in y SystemError: no locals when loading 'nonlocal_var' dis.dis(x) 2 0 LOAD_CONST 1 (code object y at 0x7f1fa5d57030, file stdin, line 2) 3 MAKE_FUNCTION0 6 STORE_FAST 1 (y) 4 9 LOAD_FAST1 (y) 12 RETURN_VALUE dis.dis(x(None)) 3 0 LOAD_CONST 1 ('keyword_only') 3 LOAD_NAME0 (nonlocal_var) 6 LOAD_CONST 2 (code object lambda at 0x7f1fa626aa48, file stdin, line 3) 9 MAKE_FUNCTION 256 12 STORE_FAST 0 (z) 15 LOAD_CONST 0 (None) 18 RETURN_VALUE Conclusion: When setting defaults to keyword-only arguments in lambdas which are inside non-global scopes, cPython is unable to access *either the free variables or global scope* and raises SystemError. This is cool, though: def y(): ... global_var ... z = lambda *, keyword_only=global_var: None ... y() dis.dis(y) 2 0 LOAD_GLOBAL 0 (global_var) 3 POP_TOP 3 4 LOAD_CONST 1 ('keyword_only') 7 LOAD_GLOBAL 0 (global_var) 10 LOAD_CONST 2 (code object lambda at 0x7f1fa5d4fd78, file stdin, line 3) 13 MAKE_FUNCTION 256 16 STORE_FAST 0 (z) 19 LOAD_CONST 0 (None) 22 RETURN_VALUE def x(nonlocal_var): ... def y(): ... nonlocal_var ... z = lambda *, keyword_only=nonlocal_var: None ... return y ... x(None)() What is happening is that LOAD_NAME is trying to access the value 'nonlocal_var' from y.__code__.co_freevars, but compilation doesn't push it there from the lambda, so adding a call to it causes it to work. The change of opcode implies that locality is decided before the opcodes are made, and so not being pushed to co_freevars changes the opcode. AKA: *When setting defaults to keyword-only arguments in lambdas which are inside non-global scopes, cPython doesn't push the name to co_freevars.* Now - where shall I report this? -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
On 11/4/2011 8:46 AM, Andrea Crotti wrote: Well this book is work in progress Though not touched since May 2009 https://bitbucket.org/BruceEckel/python-3-patterns-idioms/src but it actually looks very interesting The slightly older .pdf version is a bit bizarre as parts of both text and code are only half-translated from Java. The testing chapter contains obviously untested code like TestDemo.py [sic] with Java lines like id = ++objCounter # this is supposed to increment objCounter TestDemo test1 = TestDemo('test1') # I presume this declares test1 as a TestDemo object and text with Javaisms like *static*, *public*, *private*, *protected*, and *friendly* and a little review of Java packages. Perhaps the later sections are more useful. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
For those not aware, the compiled file caching and import system was changed for 3.2. Given test.py, the compiled file is no longer test.pyc, in the same directory, but (for cpython32) __pycache__/test.cpython-32.pyc. Given the statement 'import test', the __pycache__ directory is only searched (for the name given above) after finding test.py. So if 'test.py' is deleted or renamed to 'mytest.py', an unchanged 'import test' will *fail* instead of importing the obsolete .pyc file. So there is no longer a functional reason to delete such obsolete files. However, the OP is stuck with 2.5. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Line continuation issue\
On 11/4/2011 11:10 AM, Steven Lehar wrote: Is this the right place to propose language extensions? Yes, especially for beginners not familiar with previous discussions. My Python code keeps expanding rightwards, it is difficult to keep it contained within reasonable limits. But the standard line continuation \ is positively anti-Pythonic because an *invisible* white space between \ and [CR] will render it useless. How about a new Python symbol, maybe \\ that CAN have following whitespace which is ignored, so that seeing a \\ in the code forces it to continue on the next line. Has this issue been discussed already? Yes ;=) Peter already gave the standard answers. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Design Pattern and Python: Any book recommendation? Your view?
Search for presentations and videos by Alex Martelli. He's the goto (so to speak) person on Python design patterns. Here, for instance: http://code.google.com/edu/languages/#_python_patterns -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: leftover pyc files
On Fri, 04 Nov 2011 16:01:14 -0400, Terry Reedy wrote: For those not aware, the compiled file caching and import system was changed for 3.2. Given test.py, the compiled file is no longer test.pyc, in the same directory, but (for cpython32) __pycache__/test.cpython-32.pyc. Given the statement 'import test', the __pycache__ directory is only searched (for the name given above) after finding test.py. So if 'test.py' is deleted or renamed to 'mytest.py', an unchanged 'import test' will *fail* instead of importing the obsolete .pyc file. So there is no longer a functional reason to delete such obsolete files. However, the OP is stuck with 2.5. Oh, I don't know, removing obsolete and useless crud from your file system seems like a good enough functional reason to me :) However, the behaviour of Python 3.2 is a little more complicated than the above, since it must still support .pyc only software. If you have a .pyc file in the PYTHONPATH, but *outside* of a __pycache__ directory, and it is compiled for the correct version of Python, it will still be imported as usual. I'm not sure what happens if you have two .pyc files, one inside the cache and one outside. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: SystemError when defining
On 11/4/2011 3:10 PM, Joshua Landau wrote: def x(nonlocal_var): ... def y(): ... z = lambda *, keyword_only=nonlocal_var: None ... return y ... x(None)() ... SystemError: no locals when loading 'nonlocal_var' ... Now - where shall I report this? Joshua found bugs.python.org and, 2 hours later, a fix was applied. http://bugs.python.org/issue13343 -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: SystemError when defining
Joshua found bugs.python.org and, 2 hours later, a fix was applied. http://bugs.python.org/**issue13343 http://bugs.python.org/issue13343 It was impressively fast. Those python devs are like a hawk. Although I wasn't expecting a three-line patch (plus a three line test). -- http://mail.python.org/mailman/listinfo/python-list
Can I fully replace GNU Bash with Python?
This question concerns my process of creating Swift Linux from the base distro (antiX Linux in the past, Linux Mint Debian Edition now). (NOTE: The process I'm describing here is an oversimplification.) All of my development work takes place in the ~/develop directory. This is the directory where I enter the git clone command to download the repositories from GitHub. These repositories are 1- build, majorfunction1, majorfunction2, and so on. After I download these repositories, I have the directories ~/develop/1-build, ~/ develop/majorfunction1, ~/develop/majorfunction2, and so on. The ~/develop/1-build directory contains the scripts that build Swift Linux. Each major function needed to create Swift Linux (such as changing web browser configuration files, changing login manager configuration files, etc.) has its own majorfunction# repository. For developing the latest version of Swift Linux, I had the swift.sh script in the ~/develop/1-build directory call scripts in the majorfunction directories with commands like: sh ~/develop/majorfunction1/main.sh sh ~/develop/majorfunction2/main.sh and so on Please note that one can run any of these major functions independently OR as part of the ~/develop/1-build/swift.sh script. The ability to run any major function independently means I can focus on just one function that's not working as it should WITHOUT messing around with other functions. This ability will be especially important when I have an actual team working on Swift Linux. What I'd like to do is replace GNU Bash with Python. I know I can replace the main.sh scripts with main.py scripts. Then the commands in the swift.sh script would be: python ~/develop/majorfunction1/main.py python ~/develop/majorfunction2/main.py and so on Is there a way I can replace the ~/develop/1-build/swift.sh script with a ~/develop/1-build/swift.py script, yet still retain the ability to work on one major function WITHOUT requiring the other major functions and the 1-build directory to be present? -- http://mail.python.org/mailman/listinfo/python-list
[issue13339] Missing semicolon at Modules/posixsubprocess.c:4511
Ross Lagerwall rosslagerw...@gmail.com added the comment: Thanks! -- assignee: - rosslagerwall nosy: +rosslagerwall resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Charles-François Natali neolo...@free.fr added the comment: This is a hairy issue Indeed. Performing partial read/write may sound imperfect, but using buffered I/O around non-blockind FD is definitely not a good idea. Also, the advantage of the current approach is that at least, no data is ever lost (and changing the behavior to raise a BlockingIOError might break some code out there in the wild). Note that Java's BufferedInputStream and ReadableByteChannel also return partial reads. So I'm somewhat inclined to keep the current behavior (it would however probably be a good idea to update the documentation to warn about this limitation, though). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13254] maildir.items() broken
Changes by Florent Xicluna florent.xicl...@gmail.com: Removed file: http://bugs.python.org/file23586/issue13254_v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13254 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13254] maildir.items() broken
Changes by Florent Xicluna florent.xicl...@gmail.com: -- keywords: -needs review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13254 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12342] characters with ord above 65535 fail to display in IDLE
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 5f49b496d161 by Victor Stinner in branch 'default': Issue #12342: Fix compilation on Mac OS X http://hg.python.org/cpython/rev/5f49b496d161 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13340] list.index does not accept None as start or stop
New submission from Carl Friedrich Bolz cfb...@gmx.de: The list.index method does not accept None as start and stop, which makes the error message quite confusing: [1, 2, 3].index(2, None, None) Traceback (most recent call last): File stdin, line 1, in module TypeError: slice indices must be integers or None or have an __index__ method I checked this in 3.2.2 and 2.7.2. Seems similar to #12163. -- messages: 147000 nosy: Carl.Friedrich.Bolz priority: normal severity: normal status: open title: list.index does not accept None as start or stop type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13340 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13140] ThreadingMixIn.daemon_threads is not honored when parent is daemon
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f09e3b1603ee by Florent Xicluna in branch '2.7': Issue #13140: Fix the daemon_threads attribute of ThreadingMixIn. http://hg.python.org/cpython/rev/f09e3b1603ee New changeset 94017ce9304d by Florent Xicluna in branch '3.2': Closes #13140: Fix the daemon_threads attribute of ThreadingMixIn. http://hg.python.org/cpython/rev/94017ce9304d New changeset 6fe6769e54a5 by Florent Xicluna in branch 'default': Merge 3.2: issue #13140 http://hg.python.org/cpython/rev/6fe6769e54a5 -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13140 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13341] Incorrect documentation for u PyArg_Parse format unit
New submission from Ilya Novoselov ilya.novose...@gmail.com: Documentation states that u format unit returns buffer of 16-bit Unicode (UTF-16) data while it returns pointer to internal buffer of unicode data, which is either UCS-16 or UCS-32 http://docs.python.org/c-api/arg.html -- assignee: docs@python components: Documentation, Unicode messages: 147002 nosy: Ilya.Novoselov, docs@python, ezio.melotti priority: normal severity: normal status: open title: Incorrect documentation for u PyArg_Parse format unit type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Antoine Pitrou pit...@free.fr added the comment: Also, the advantage of the current approach is that at least, no data is ever lost But what about the buggy readline() behaviour? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Antoine Pitrou pit...@free.fr added the comment: Note that Java's BufferedInputStream and ReadableByteChannel also return partial reads. Apparently, they are specified to, even for blocking streams (which I find a bit weird, and the language in the docs seems deliberately vague). Python's buffered read(), though, is specified to return the requested number of bytes (unless EOF happens). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
New submission from stefanholek ste...@epy.co.at: The input builtin always uses strict error handling for Unicode conversions. This means that when I enter a latin-1 string in a utf-8 environment, input breaks with a UnicodeDecodeError. Now don't tell me not to do that, I have a valid use-case. ;-) While strict may be a good default choice, it is clearly not sufficient. I would like to propose an optional 'errors' argument to input, similar to the 'errors' argument the decode and encode methods have. I have in fact implemented such an input method for my own use: https://github.com/stefanholek/rl/blob/surrogate-input/rl/input.c While this solves my immediate needs, the fact that my implementation is basically just a copy of bltinmode.input with one additional argument, makes me think that this could be fixed in Python proper. There cannot be a reason input() should be confined to strict, or can there? ;-) -- components: Unicode messages: 147005 nosy: ezio.melotti, stefanholek priority: normal severity: normal status: open title: input() builtin always uses strict error handler type: behavior versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13241] llvm-gcc-4.2 miscompiles Python (XCode 4.1 on Mac OS 10.7)
Lucas Sinclair blastoc...@mac.com added the comment: I'm on 10.7.2, with XCode is 4.2 and the problem is still present. The command ggc -v produces the following output: gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) The command ./configure --with-pydebug make -j2 fails with the following output: Assertion failed: (compact-utf8_length == 0), function _PyUnicode_CheckConsistency, file Objects/unicodeobject.c, line 381. make: *** [sysconfig] Abort trap: 6 The only solution seems to be to install macports and use it to get a more recent gcc like Oleg Plakhotnyuk suggested. -- nosy: +xapple ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13241 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Benjamin Peterson benja...@python.org added the comment: There's no reason you couldn't write your own input() function in Python to do this. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
stefanholek ste...@epy.co.at added the comment: I am not quite sure how I would write a custom, readline-using input function in Python (access to PyOS_Readline seems required), that's why I did it in C. Have an example? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
sbt shibt...@gmail.com added the comment: No one has suggested raising BlockingIOError and DISCARDING the data when a partial read has occurred. The docs seem to imply that the partially read data should be returned since they only say that BlockingIOError should be raised if there is NOTHING to read. Clearly this should all be spelt out properly. That leaves the question of whether, when there is NOTHING to read, BlockingIOError should be raised (as the docs say) or None should be returned (as is done now). I don't mind either way as long as the docs match reality. The part which really needs addressing is partial writes. Currently, if a write fails with EAGAIN then IOError is raised and there is no way to work out how much data was written/buffered. The docs say that BlockingIOError should be raised with the e.args[2] set to indicate the number of bytes written/buffered. This at least should be fixed. I will work on a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Antoine Pitrou pit...@free.fr added the comment: There cannot be a reason input() should be confined to strict, or can there? ;-) Actually, there's a good reason: in the non-interactive case, input() simply calls sys.stdin.read(), which doesn't have encoding or errors attributes. You want to override sys.stdin so that it has the right error handler. However, there is a bug in input() in that it ignores sys.stdin's error handler in interactive mode (where it delegates to the readline library, if present): import sys, io sys.stdin = io.TextIOWrapper(sys.stdin.detach(), ascii, replace) sys.stdin.read() héhé 'h��h��\n' input() héhé Traceback (most recent call last): File stdin, line 1, in module UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128) If you don't mind losing GNU readline functionality, the immediate workaround for you is to use sys.stdin.read() directly. -- components: +Interpreter Core -Unicode nosy: +pitrou stage: - needs patch versions: -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
sbt shibt...@gmail.com added the comment: But what about the buggy readline() behaviour? Just tell people that if the return value is a string which does not end in '\n' then it might caused by EOF or EAGAIN. They can just call readline() again to check which. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
sbt shibt...@gmail.com added the comment: The third arg of BlockingIOError is used in two quite different ways. In write(s) it indicates the number of bytes of s which have been consumed (ie written to the raw file or buffered). But in flush() and flush_unlocked() (in _pyio) it indicates the number of bytes from the internal buffer which have been written to the raw file. I think this explains the following comment in write(): # We're full, so let's pre-flush the buffer try: self._flush_unlocked() except BlockingIOError as e: # We can't accept anything else. # XXX Why not just let the exception pass through? raise BlockingIOError(e.errno, e.strerror, 0) I don't think flush() should try to tell us how many bytes were flushed: we only need to know whether we need to try again. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Charles-François Natali neolo...@free.fr added the comment: Apparently, they are specified to, even for blocking streams (which I find a bit weird, and the language in the docs seems deliberately vague). As an additional convenience, it attempts to read as many bytes as possible by repeatedly invoking the read method of the underlying stream. This iterated read continues until one of the following conditions becomes true: The specified number of bytes have been read, The read method of the underlying stream returns -1, indicating end-of-file, or The available method of the underlying stream returns zero, indicating that further input requests would block. As I understand it, it will return the number of bytes asked, unless EOF or EAGAIN/EWOULDBLOCK. It would seem reasonable to me to add the same note for non-blocking FDs to Python's read(). But what about the buggy readline() behaviour? Just tell people that if the return value is a string which does not end in '\n' then it might caused by EOF or EAGAIN. They can just call readline() again to check which. Sounds reasonable. No one has suggested raising BlockingIOError and DISCARDING the data when a partial read has occurred. The problem is that if we raise BlockingIOError, we can only buffer a limited amount of data. The docs seem to imply that the partially read data should be returned since they only say that BlockingIOError should be raised if there is NOTHING to read. Clearly this should all be spelt out properly. Agreed. That leaves the question of whether, when there is NOTHING to read, BlockingIOError should be raised (as the docs say) or None should be returned (as is done now). I don't have a string feeling: if we don't raise BlockingIOError on partial reads, then it probably makes sense to keep None. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13241] llvm-gcc-4.2 miscompiles Python (XCode 4.1 on Mac OS 10.7)
Ned Deily n...@acm.org added the comment: Lucas, exactly what source version of Python are you trying to build (i.e what does hg summary say)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13241 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13283] removal of two unused variable in locale.py
Éric Araujo mer...@netwok.org added the comment: Our policy is to not commit code cleanup patches that are not strict bug fixes; see thread at http://mail.python.org/pipermail/python-dev/2011-October/114281.html and http://mail.python.org/pipermail/python-dev/2011-November/114301.html -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13283 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12498] asyncore.dispatcher_with_send, disconnection problem + miss-conception
Xavier de Gaye xdeg...@gmail.com added the comment: Attached yet another patch. This patch does not use a while loop in handle_close() and handles POLLHUP as suggested by Charles-François. No changes have been made to both tests (test_half_duplex_close). -- Added file: http://bugs.python.org/file23609/half_duplex_close_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12498 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5301] add mimetype for image/vnd.microsoft.icon (patch)
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 33680de042e7 by Éric Araujo in branch '2.7': Revert commit that was not a bugfix (#5301). http://hg.python.org/cpython/rev/33680de042e7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5301 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13241] llvm-gcc-4.2 miscompiles Python (XCode 4.1 on Mac OS 10.7)
Lucas Sinclair blastoc...@mac.com added the comment: I just cloned cpython today. The output of hg summary is: parent: 73351:2bec7c452b39 tip Fix C89 incompatibility. branch: default commit: (clean) update: (current) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13241 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12260] Make install default to user site-packages
Éric Araujo mer...@netwok.org added the comment: With the raise of virtualenv and its inclusion in CPython for 3.3, this is even less a concern, even for UNIX. I’m withdrawing the idea and will continue to advertise --user and warn against sudo in documentation and other venues. -- assignee: tarek - eric.araujo resolution: - rejected stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12260 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Antoine Pitrou pit...@free.fr added the comment: Here is a patch. The bugfix itself is quite pedestrian, but the test is more interesting. I did what I could to fork a subprocess into a pseudoterminal so as to trigger the GNU readline code path. The only limitation I've found is that I'm unable to read further on the child's stdout after input() has been called. The test therefore uses a pipe to do the return checking. -- keywords: +patch nosy: +neologix stage: needs patch - patch review Added file: http://bugs.python.org/file23610/input_readline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Rob Bairos rbai...@gmail.com added the comment: Yah, thinking about this further, the real error is that sys.meta_path allows processing of names with #,?* etc. I can see why this would cause problems, as python names must only be _ and alphanumeric characters. I'll re-implement this. Thanks. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13311] asyncore handle_read should call recv
Charles-François Natali neolo...@free.fr added the comment: Since this patch may break existing valid code, I think it should be closed as invalid. Yes. Since the benefit is not clear and it may break existing code, it's probably wiser. -- resolution: - rejected stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
sbt shibt...@gmail.com added the comment: Currently a BlockingIOError exception raised by flush() sets characters_written to the number of bytes fushed from the internal buffer. This is undocument (although there is a unit test which tests for it) and causes confusion because characters_written has conflicting meanings depending on whether the exception was raised by flush() or write(). I would propose setting characters_written to zero on BlockingIOError exceptions raised by flush(). Are there any reasons not to make this change? Also, the docs say that the raw file wrapped by BufferedReader/BufferedWriter should implement RawIOBase. This means that self.raw.write() should return None instead of raising BlockingIOError. But the implementation tries to cope with BlockingIOError coming from a raw write. In fact, the MockNonBlockWriterIO class in unit tests is used as a raw file, but its write() method raises BlockingIOError. It would simplify matters a lot to insist that raw files implement RawIOBase properly. BTW, when I try to change characters_written of an existing BlockingIOError exception using the pointer returned by _buffered_check_blocking_error(), it appears not to work: the exception continues to have characters_written == 0 -- not sure why... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13341] Incorrect documentation for u PyArg_Parse format unit
STINNER Victor victor.stin...@haypocalc.com added the comment: Can you write a patch? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13287] urllib.request exposes too many names
STINNER Victor victor.stin...@haypocalc.com added the comment: test_urllib2.test___all__() is failing on Windows. Example: http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/5498/steps/test/logs/stdio == FAIL: test___all__ (test.test_urllib2.TrivialTests) -- Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_urllib2.py, line 32, in test___all__ (k, module, v.__module__)) AssertionError: 'nturl2path' != 'urllib.request' - nturl2path + urllib.request : 'pathname2url' is exposed in 'urllib.request' but defined in 'nturl2path' -- -- nosy: +haypo resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13287 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
New submission from Joshua Landau joshua.landau...@gmail.com: When setting defaults to keyword-only arguments in lambdas which are inside non-global scopes, cPython doesn't push the name to it's closure's co_freevars. EXAMPLE: global_variable = None (lambda: (lambda *, keyword_only=global_variable: None))() Because the inner lambda hasn't told the outer lambda to put global_variable in co_freevars, it fails to create the default to keyword_only. This only happens if the inner function is a lambda and you are setting a keyword_only variable. It does not cause a crash if global_variable is local to the outer lambda, as the opcode LOAD_FAST is still created properly (as opposed to LOAD_NAME). It does not crash if global_variable is used elsewhere in the outer function as co_freevars will be updated with it, allowing LOAD_NAME to retrieve it. I've never done a bug here before and I'm unsure what to say, so please be nice and correct me if I'm doing it wrong. -- components: Interpreter Core messages: 147026 nosy: Joshua.Landau priority: normal severity: normal status: open title: Lambda keyword-only argument not updating co_freevars type: crash versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Antoine Pitrou pit...@free.fr added the comment: But what about the buggy readline() behaviour? Just tell people that if the return value is a string which does not end in '\n' then it might caused by EOF or EAGAIN. They can just call readline() again to check which. Sounds reasonable. But then what's the point of using buffered I/O at all? If it can't offer anything more than raw I/O, I'd rather do something like raise a RuntimeError(buffered I/O doesn't work with non-blocking streams) when the raw stream returns None. Returning partial results on a buffered's readline() is not something we should ever do. (actually, raw I/O readline() is probably buggy as well) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
Charles-François Natali neolo...@free.fr added the comment: But then what's the point of using buffered I/O at all? If it can't offer anything more than raw I/O, I'd rather do something like raise a RuntimeError(buffered I/O doesn't work with non-blocking streams) when the raw stream returns None. Well, ideally it should be an UnsupportedOperation, but that's an option. The only think I didn't like about this is that we should ideally raise this error upon the first method call, not when - and if - we receive EAGAIN. Another possibility would be that, since lines are usually reasonably sized, they should fit in the buffer (which is 8KB by default). So we could do the extra effort of buffering the data and return it once the line is complete: if the buffer fills up before we got the whole line, then we could raise a RuntimeError(Partial line read). Note that I didn't check if it's easily feasible (i.e. we should avoid introducing kludges in the I/O layer just to handle thi corner case). Returning partial results on a buffered's readline() is not something we should ever do. Yeah, I know. Java made the choice of making readline() block, which is IMHO even worse (I mean, it defeats the whole point of non-blocking I/O...). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Charles-François Natali neolo...@free.fr added the comment: The bugfix itself is quite pedestrian, but the test is more interesting. Indeed. Looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Changes by Mark Dickinson dicki...@gmail.com: -- priority: normal - critical stage: - needs patch versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3067] setlocale error message is confusing
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 931ae170e51c by Petri Lehtinen in branch '3.2': Issue #3067: Fix the error raised by locale.setlocale() http://hg.python.org/cpython/rev/931ae170e51c New changeset d90d88380aca by Petri Lehtinen in branch 'default': Issue #3067: Fix the error raised by locale.setlocale() http://hg.python.org/cpython/rev/d90d88380aca -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Here is a patch, with a minimal test. -- keywords: +patch nosy: +amaury.forgeotdarc Added file: http://bugs.python.org/file23611/issue13343.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3067] setlocale error message is confusing
Petri Lehtinen pe...@digip.org added the comment: Terry: Do you still think there's need for a doc update? -- resolution: - fixed status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: same patch, without tabs. -- Added file: http://bugs.python.org/file23612/issue13343.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Changes by Amaury Forgeot d'Arc amaur...@gmail.com: Removed file: http://bugs.python.org/file23611/issue13343.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13321] fstat doesn't accept an object with fileno method
Changes by Petri Lehtinen pe...@digip.org: -- resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13321] fstat doesn't accept an object with fileno method
Petri Lehtinen pe...@digip.org added the comment: Closing as wontfix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
stefanholek ste...@epy.co.at added the comment: Thank you Antoine, this looks good. However when I try your example I get sys.stdin = io.TextIOWrapper( sys.stdin.detach(), 'ascii', 'replace') ValueError: underlying buffer has been detached /helpforum -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Antoine Pitrou pit...@free.fr added the comment: However when I try your example I get sys.stdin = io.TextIOWrapper( sys.stdin.detach(), 'ascii', 'replace') ValueError: underlying buffer has been detached Which version of Python (and which OS?). It works fine here on latest 3.2 and 3.3 branches. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Mark Dickinson dicki...@gmail.com added the comment: Patch looks good to me. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Stefan Holek ste...@epy.co.at added the comment: This is with Python 3.2.2 on Mac OS X 10.6 (SL). I have built Python from source with: ./configure; make; make install. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13344] closed sockets don't raise EBADF anymore
New submission from Antoine Pitrou pit...@free.fr: This decrepancy between 2.x and 3.x is witnessed under Windows: Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. import socket sock = socket.create_connection((www.python.org, 80)) sock.close() sock.send(bx) Traceback (most recent call last): File stdin, line 1, in module File c:\python27\lib\socket.py, line 170, in _dummy raise error(EBADF, 'Bad file descriptor') socket.error: [Errno 9] Bad file descriptor Python 3.2.1 (default, Jul 10 2011, 20:02:51) [MSC v.1500 64 bit (AMD64)] on win 32 Type help, copyright, credits or license for more information. import socket sock = socket.socket(); sock.connect((www.python.org, 80)) sock.close() sock.send(bx) Traceback (most recent call last): File stdin, line 1, in module socket.error: [Errno 10038] An operation was attempted on something that is not a socket I'm not sure this is worth fixing, though. -- components: Library (Lib) messages: 147039 nosy: exarkun, pitrou priority: low severity: normal status: open title: closed sockets don't raise EBADF anymore type: behavior versions: Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13287] urllib.request exposes too many names
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset ca78ed7393bf by Florent Xicluna in branch 'default': Fix test_urllib2 error on Windows in relation with issue #13287. http://hg.python.org/cpython/rev/ca78ed7393bf -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13287 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13287] urllib.request exposes too many names
Changes by Florent Xicluna florent.xicl...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13287 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13344] closed sockets don't raise EBADF anymore
Antoine Pitrou pit...@free.fr added the comment: discrepancy, not decrepancy :S (10038 is WSAENOTSOCK, by the way) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12498] asyncore.dispatcher_with_send, disconnection problem + miss-conception
Giampaolo Rodola' g.rod...@gmail.com added the comment: I think this thread is becoming a little messy and since asyncore/asynchat are in a situation where even the slightest change can break existent code I recommend to be really careful. I see 3 different issues here: 1 - dispatcher_with_send closing the socket without sending pending data (this was the initial issue) 2 - dispatcher_with_send default buffer is too small (512 bytes) 3 - add support for correct POLLHUP/socket.shutdown() handling (msg146946) All of them should be treated and discussed separately in their own ticket to figure out: - what's wrong - whether it's a bugfix or a new feature (POLLHUP handling appears to be so) - for what python version(s) the patch should be applied As a final note we should consider mandatory for any patch not to alter the existent API. initiate_send() method suddenly returning a meaningful value might be the case and as such it should be weighed up first. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12498 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13344] closed sockets don't raise EBADF anymore
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 1e0e821d2626 by Amaury Forgeot d'Arc in branch '3.2': Issue #13343: Fix a SystemError when a lambda expression uses a global http://hg.python.org/cpython/rev/1e0e821d2626 New changeset bddb455439d0 by Amaury Forgeot d'Arc in branch 'default': Issue #13343: Fix a SystemError when a lambda expression uses a global http://hg.python.org/cpython/rev/bddb455439d0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: It was a bug in Python compiler, thanks for the report! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Stefan Holek ste...@epy.co.at added the comment: Python 3.2.2 (default, Nov 4 2011, 22:28:55) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. import sys, io w = io.TextIOWrapper(sys.stdin.detach(), 'ascii', 'replace') input built-in function input input() Traceback (most recent call last): File stdin, line 1, in module ValueError: underlying buffer has been detached -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13343] Lambda keyword-only argument not updating co_freevars
Joshua Landau joshua.landau...@gmail.com added the comment: Glad to help :) It's made my day. I get to boast at school now! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13343 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Stefan Holek ste...@epy.co.at added the comment: Oops, the last one wasn't meant for the bug tracker. blush -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13322] buffered read() and write() does not raise BlockingIOError
sbt shibt...@gmail.com added the comment: Another possibility would be that, since lines are usually reasonably sized, they should fit in the buffer (which is 8KB by default). So we could do the extra effort of buffering the data and return it once the line is complete: if the buffer fills up before we got the whole line, then we could raise a RuntimeError(Partial line read). Note that I didn't check if it's easily feasible (i.e. we should avoid introducing kludges in the I/O layer just to handle thi corner case). Discarding data rarely is worse than always throwing an exception. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Stefan Holek ste...@epy.co.at added the comment: I can make it work at the interpreter prompt with your patch applied. Sorry for cluttering up the ticket. ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13342] input() builtin always uses strict error handler
Antoine Pitrou pit...@free.fr added the comment: I can make it work at the interpreter prompt with your patch applied. Sorry for cluttering up the ticket. ;-) That's ok, thanks a lot for testing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13290] get vars for object with __slots__
Terry J. Reedy tjre...@udel.edu added the comment: New features only go in future versions: Given the doc: With a module, class or class instance object as argument (or anything else that has a __dict__ attribute), return that attribute. So you are proposing a change in the definition of vars() input. I agree that the proposal is a good idea as far as it goes. Vars() predates __slots__ (introduced in 2.2). In particular, adding or deleting a __slots__ binding to a user-defined class should not change the behavior of vars(). I am thinking that the doc should also be tweaked a bit. It implies that all class instances have a __dict__ attribute. Before 2.2, when 'class' meant a user-defined old style class, that was true. But with 'types' becoming new-style classes, it is not. Perhaps the domain of vars() should be extended to all objects, returning {} if nothing more. I may bring that idea to python-ideas list. You should attach diffs (context diffs, I believe) rather than files so we can see what you changed. The diff module can create such. I believe your changes come after the following: d = PyObject_GetAttrString(v, __dict__); if (d == NULL) { The statement '''slots = PyObject_GetAttrString(v, __slots__)''' gets the attribute from the object itself. Like most special attributes other than __dict__, it should be gotten from the object's class (or superclasses). [I don't know the C version of doing this.] For example, suppose v is a class with a custom metaclass and type(v).__slots__ == ('__slots__', '__init__') whereas v.__slots__ == ('a', 'b') (and v.__init__ is not assigned). Then vars(v) should return {'__slots__': ('__slots__', '__init__')}. The comment /* Find attributes out of __slots__ */ seems misleading. I believe it should be /* Convert string to iterable of 1 string */ New code for 3.3 should use the new unicode api from pep 393. Though I could be wrong, I believe PyUnicode_Check() has been replaced. Your example __slots__ = {'some': 'mapping'} is somewhat strange. It works, but only because iterating dicts iterates the keys, and the key is a string. As far as I know, the value is ignored and useless, so I hope no one does this. Perhaps your only point was to test a non-sequence iterable of strings. A patch should include a patch to the appropriate Lib/test/testxxx.py file. -- nosy: +terry.reedy stage: - needs patch versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13290 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com