Re: Understanding and dealing with an exception
On 14/10/2012 05:23, Vincent Davis wrote: I am working on a script to find bad image files. I am using PIL and specifically image.verify() I have a set of known to be bad image files to test. I also what to be able to test any file for example a .txt and deal with the exception. Currently my code is basically try: im = Image.open(ifile) try: print(im.verify()) except: print('Pil image.verify() failed: ' + afile) except IOError: print('PIL cannot identify image file: ' + afile) except: print(ifile) print(Unexpected error doing PIL.Image.open():, sys.exc_info()[0]) raise [snip] Vincent You've already had some advice so I'll just point out that a bare except is a bad idea as you wouldn't even be able to catch a user interrupt. Try (groan!) catching StandardError instead. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
python game develop:framework?
Something good framwork? -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding and dealing with an exception
On 10/14/2012 4:20 AM, Mark Lawrence wrote: You've already had some advice so I'll just point out that a bare except is a bad idea as you wouldn't even be able to catch a user interrupt. Try (groan!) catching StandardError instead. There are some bare except:s in the stdlib, that adding another is frowned on and removing one is smiled upon. However: StandardError Traceback (most recent call last): File pyshell#0, line 1, in module StandardError NameError: name 'StandardError' is not defined Try: Exception class 'Exception' This catches everything except a few things like Keyboard Interrupt that you normally should not catch. BaseException class 'BaseException' This catches everything, but signals that doing so is probably intentional. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: python game develop:framework?
On Sun, 14 Oct 2012 01:58:57 -0700, nepaul wrote: Something good framwork? http://duckduckgo.com/?q=python+%2Bgame+frameworks http://duckduckgo.com/?q=python+%2Bgame+libraries http://blekko.com/ws/?q=python%20game%20framework -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: __builtins__ thread-safe / __builtins__ as function?
One possible solution is to somehow redirect every __builtins__ to a function that returns a different __builtins__ dictionary for each thread (such a function already exists). How exactly does the code reference it? If they're simply referring to the name __builtins__ at module level, you ought to be able to import the module, then assign some_module.__builtins__ to your thread-local object, then call code in it as normal. An interesting problem, and one where monkeypatching is, imho, justified. ChrisA Hello, and thanks for your answer. Unfortunately, replacing __builtins__ at import time won't do, because external modules (that is, .py) get imported only once when they are accessed by the first thread, which includes (of course) setting up of __dict__ and __builtins__. When a second thread later accesses this module, it has the same variables in __builtins__ that were added by the same module in first thread And if the second thread then changes the values, I can see these same changes in the first thread. - The problem is that __builtins__ are global, not thread-safe. The only solution I can see is therfor redirecting __builtins__ to a function which returns a different dictionary for each thread, e.g. by intercepting __builtins__-calls with __readattr__. To do this, I would need my own class to define __readattr__ in since (as far as I know) I can't define __readattr__ in a module, and I can't change metaclass module of course. I really don't know how to get around this problem... -- http://mail.python.org/mailman/listinfo/python-list
Re: python game develop:framework?
Pygame is my favorite. It's mature, has good documentation, and has lots of unfinished and finished games on its website. It also supports OpenGL. http://www.pygame.org/ On 10/14/2012 01:58 AM, nepaul wrote: Something good framwork? -- http://mail.python.org/mailman/listinfo/python-list
Re: python game develop:framework?
On 2012-10-14 08:58:57 +, nepaul said: Something good framwork? I just want to sencond PyGame. It's compelling with a good user base and has development activity e.g. patches and improvements etc. are provided. -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding and dealing with an exception
On 14/10/2012 11:06, Terry Reedy wrote: On 10/14/2012 4:20 AM, Mark Lawrence wrote: You've already had some advice so I'll just point out that a bare except is a bad idea as you wouldn't even be able to catch a user interrupt. Try (groan!) catching StandardError instead. There are some bare except:s in the stdlib, that adding another is frowned on and removing one is smiled upon. However: StandardError Traceback (most recent call last): File pyshell#0, line 1, in module StandardError NameError: name 'StandardError' is not defined Try: Exception class 'Exception' This catches everything except a few things like Keyboard Interrupt that you normally should not catch. BaseException class 'BaseException' This catches everything, but signals that doing so is probably intentional. White Man type with forked fingers? c:\Users\Mark\Cash\Pythonpython Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. StandardError type 'exceptions.StandardError' Perhaps not. c:\Users\Mark\Cash\Pythonpy -3 Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. StandardError Traceback (most recent call last): File stdin, line 1, in module NameError: name 'StandardError' is not defined Down to this http://www.python.org/dev/peps/pep-3151/ or was it done earlier? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
LinkedIn Python group discussions
I've been sparked into raising the subject as this has just come up Does Jython/Python fall short of true POSIX thread parallelism?. I'm not qualified to comment and I recognise relatively few names amongst the people who do participate over there. The last thing I'd want would be FUD or worse still complete crap being written in response to any thread and me not being in a position to reply. Is this something for the Python community here to be thinking about? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Feedback on my python framework I'm building.
In article 507a3365$0$6574$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. But, trivial to implement as an extension :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: __builtins__ thread-safe / __builtins__ as function?
On Sun, Oct 14, 2012 at 9:36 PM, Juergen Bartholomae bartholomae.juer...@googlemail.com wrote: Unfortunately, replacing __builtins__ at import time won't do, because external modules (that is, .py) get imported only once when they are accessed by the first thread, which includes (of course) setting up of __dict__ and __builtins__. When a second thread later accesses this module, it has the same variables in __builtins__ that were added by the same module in first thread Sure. But if they're using __builtins__ by name, then you can simply replace that with something that checks a thread id and responds with that thread's dictionary. There's no particular reason for __builtins__ to be a module (as far as I know!), so you should be able to replace it with an object of your own class. I think DaveA's recommendation is good. Make a Version 2.0 of your system, with a different way of doing global state. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding and dealing with an exception
On 2012-10-14 05:23, Vincent Davis wrote: I am working on a script to find bad image files. I am using PIL and specifically image.verify() I have a set of known to be bad image files to test. I also what to be able to test any file for example a .txt and deal with the exception. Currently my code is basically try: im = Image.open(ifile) try: print(im.verify()) except: print('Pil image.verify() failed: ' + afile) except IOError: print('PIL cannot identify image file: ' + afile) except: print(ifile) print(Unexpected error doing PIL.Image.open():, sys.exc_info()[0]) raise [snip] I notice that you have both ifile and afile. Is that correct? -- http://mail.python.org/mailman/listinfo/python-list
pyw program not displaying unicode characters properly
Hi everybody ! Our language lab at INALCO is using a nice language parsing and analysis program written in Python. As you well know a lot of languages use characters that can only be handled by unicode. Here is an example of the problem we have on some Windows computers. In the attached screen-shot (DELETED), the bambara character (a sort of epsilon) is displayed as a square. The fact that it works fine on some computers and fails to display the characters on others suggests that it is a user configuration issue: Recent observations: it's OK on Windows 7 but not on Vista computers, it's OK on some Windows XP computers, it's not on others Windows XP... On the computers where it fails, we've tried to play with options in the International settings, but are not able to fix it. Any idea that would help us go in the right direction, or just fix it, is welcome ! Thanks! I ni ce! (in bambara, a language spoken in Mali, West Africa) -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
jjmeric jjme...@free.fr writes: Our language lab at INALCO is using a nice language parsing and analysis program written in Python. As you well know a lot of languages use characters that can only be handled by unicode. Here is an example of the problem we have on some Windows computers. In the attached screen-shot (DELETED), Usenet has no attachments. Place your document on some publicly accessible web-servers, if needed. the bambara character (a sort of epsilon) is displayed as a square. The fact that it works fine on some computers and fails to display the characters on others suggests that it is a user configuration issue: Recent observations: it's OK on Windows 7 but not on Vista computers, it's OK on some Windows XP computers, it's not on others Windows XP... You need a font that has glyphs for all unicode characters (at least the ones you use). See http://en.wikipedia.org/wiki/Unicode_font for a start. I don't know enough about Windows to give you a name. Anyone? -- Alain. P/S: and this has not much to do with python, which will happily send out any unicode char, and cannot know which ones your terminal/whatever will be able to display -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
On 2012-10-14 17:55, jjmeric wrote: Hi everybody ! Our language lab at INALCO is using a nice language parsing and analysis program written in Python. As you well know a lot of languages use characters that can only be handled by unicode. Here is an example of the problem we have on some Windows computers. In the attached screen-shot (DELETED), the bambara character (a sort of epsilon) is displayed as a square. The fact that it works fine on some computers and fails to display the characters on others suggests that it is a user configuration issue: Recent observations: it's OK on Windows 7 but not on Vista computers, it's OK on some Windows XP computers, it's not on others Windows XP... On the computers where it fails, we've tried to play with options in the International settings, but are not able to fix it. Any idea that would help us go in the right direction, or just fix it, is welcome ! Thanks! I ni ce! (in bambara, a language spoken in Mali, West Africa) A square is shown when the font being used doesn't contain a visible glyph for the codepoint. Which codepoint is it? What is the codepoint's name? Here's how to find out: hex(ord(Ɛ)) '0x190' import unicodedata unicodedata.name(Ɛ) 'LATIN CAPITAL LETTER OPEN E' -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding and dealing with an exception
Yes afile is the file name and extension, ifile is the full file name and path. Thanks Vincent On Sunday, October 14, 2012, MRAB wrote: On 2012-10-14 05:23, Vincent Davis wrote: I am working on a script to find bad image files. I am using PIL and specifically image.verify() I have a set of known to be bad image files to test. I also what to be able to test any file for example a .txt and deal with the exception. Currently my code is basically try: im = Image.open(ifile) try: print(im.verify()) except: print('Pil image.verify() failed: ' + afile) except IOError: print('PIL cannot identify image file: ' + afile) except: print(ifile) print(Unexpected error doing PIL.Image.open():, sys.exc_info()[0]) raise [snip] I notice that you have both ifile and afile. Is that correct? -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
Alain, MRAB Thank you for prompt responses. What they suggest to me is I should look into what font is being used by this Python for Windows program. I am not the programmer, so not idea where to look for. The program settings do not include a choice for display font. The font that used for display resembles a sort of Helvetica, but no idea how to check this. Is there some sort of defaut font, or is there in Python or Python for Windows any ini file where the font used can be seen, eventually changed to a more appropriate one with all the required glyphs (like Lucida Sans Unicode has). Thanks again... -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding http proxies
Olive di...@bigfoot.com wrote: it seems when I read the code above that the proxy acts mostly as an orinary server with respect to the client except that it is supposed to receive the full URL instead of just the path. Am I right? Is there any documentation on what an http proxy is supposed to implement. Consider the ways HTTP could have been implemented. Say we have a request to get http://www.bigsite.com/pictures/index.html . One way HTTP could have been implemented is by sending this request to the server at www.bigsite.com: GET /pictures/index.html HTTP/1.0 If that were how HTTP were done, you could not implement a proxy, because there isn't enough information for any intermediates to know where the request had to end up. Instead, http looks like this: GET /pictures/index.html HTTP/1.1 Host: www.bigsite.com Now, even if this is sent to someone who is not www.bigsite.com, that receipient can tell exactly who is supposed to get the message. So, a web proxy receives requests intended for other sites, and forwards them on, possibly after restricting or modifying them. That's it. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Tkinter how to access the widget by name
I'm a little teapot ... himself the question: if I want to appeal to the widget, knowing his name... ? # appropriated the name of the widget label = Label(frame, width = 40, text='text', name = 'name') ... name_='name' configure(name_) ... def configure(name_) #And how can that be? # At least let the text you want to change I beg you .. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
In article mailman.2178.1350235875.27098.python-l...@python.org, MRAB pyt...@mrabarnett.plus.com wrote: Which codepoint is it? What is the codepoint's name? Here's how to find out: hex(ord(?)) '0x190' import unicodedata unicodedata.name(?) 'LATIN CAPITAL LETTER OPEN E' Wow, I never knew you could do that. I usually just google for unicode 0190 :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
On Sun, 14 Oct 2012 19:19:33 +0200, Alain Ketterlin wrote: Usenet has no attachments. *snarfle* You almost owed me a new monitor. I nearly sprayed my breakfast all over it. Usenet has no attachments -- that's like saying that the Web has no advertisements. Maybe the websites you visit have no advertisements, but there's a *vast* (and often disturbing) part of the WWW that has advertisements, some sites are nothing but advertisements. And so it is with Usenet, there is a vast (and often disturbing) area of Usenet containing attachments, and often nothing but attachments. The vast volume of all these attachments are such that it is getting hard to find ISPs that provide free access to binary newsgroups, but some still do, and dedicated for-fee Usenet providers do too. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
On Sun, Oct 14, 2012 at 1:36 PM, jjmeric jjme...@free.fr wrote: Is there some sort of defaut font, or is there in Python or Python for Windows any ini file where the font used can be seen, eventually changed to a more appropriate one with all the required glyphs (like Lucida Sans Unicode has). No, this is up to the program and the GUI framework it uses. Do you have any idea which one that would be (e.g. Tkinter, wxPython, PyQT, etc.)? -- http://mail.python.org/mailman/listinfo/python-list
Use the appropriate forum for recruitment (was: Client Needs Linux Admin position in Pleasanton, CA)
ram dev ramdevtech.net...@gmail.com writes: Good Day, We have an urgent Contract Opening in Pleasanton, CA. Please don't use this discussion forum for recruitment. For Python job recruiters and seekers, we have a separate Python Job Board URL:http://www.python.org/community/jobs/. Job Title: Linux Admin You should find a Linux job board for that. -- \ “I distrust those people who know so well what God wants them | `\to do to their fellows, because it always coincides with their | _o__) own desires.” —Susan Brownell Anthony, 1896 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
In article mailman.2180.1350249596.27098.python-l...@python.org, ian.g.ke...@gmail.com says... On Sun, Oct 14, 2012 at 1:36 PM, jjmeric jjme...@free.fr wrote: Is there some sort of defaut font, or is there in Python or Python for Windows any ini file where the font used can be seen, eventually changed to a more appropriate one with all the required glyphs (like Lucida Sans Unicode has). No, this is up to the program and the GUI framework it uses. Do you have any idea which one that would be (e.g. Tkinter, wxPython, PyQT, etc.)? Thanks Ian I have no idea, but - thanks to you - I now have an interesting question to ask back to the team who works on this in Russia... more later ! -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble with nested closures: one of my variables is missing...
On 13Oct2012 22:07, Chris Rebert c...@rebertia.com wrote: | On Saturday, October 13, 2012, Cameron Simpson wrote: | I'm having some trouble with closures when defining a decorator. | snip | | However, I can't make my make_file_property function work. I've stripped | the code down and it does this: | snip | |Traceback (most recent call last): | File foo.py, line 21, in module |def f(self, foo=1): | File foo.py, line 4, in file_property |return make_file_property()(func) | File foo.py, line 10, in made_file_property |if attr_name is None: |UnboundLocalError: local variable 'attr_name' referenced before | assignment | | Observe above that 'unset_object' is in locals(), but not 'attr_name'. | This surprises me. | | The stripped back code (missing the internals of the file property | watcher) looks like this: | |import sys | |def file_property(func): | return make_file_property()(func) | |def make_file_property(attr_name=None, unset_object=None, poll_rate=1): | print sys.stderr, make_file_property(attr_name=%r, unset_object=%r, | poll_rate=%r): locals()=%r % (attr_name, unset_object, poll_rate,locals()) | def made_file_property(func): | | You're missing a nonlocal declaration here. | | print sys.stderr, made_file_property(func=%r): locals()=%r % | (func, locals()) |if attr_name is None: | attr_name = '_' + func.__name__ | | | You assign to it, but there's no nonlocal declaration, so Python thinks | it's a local var, hence your error. But 'unset_object' is in locals(). Why one and not the other? Obviously there's something about closures here I'm missing. | Pardon my brevity and some lack of trimming; I'm on a smartphone and in a | rush. No worries. Thansk for the rpely. -- Cameron Simpson c...@zip.com.au A clean desk is the sign of a blank mind. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
Zero Piraeus sche...@gmail.com writes: I'm a mostly passive subscriber to this list - my posts here over the years could probably be counted without having to take my socks off - so perhaps I have no right to comment, but I've noticed a marked increase in aggressive language here lately, so I'm putting my head above the parapet to say that I don't appreciate it. Thanks for speaking up, Zero. You are certainly not alone in this. “Ignore the trolls” is not helpful advice if one wants to maintain a useful and friendly environment. If the hostile behaviour you refer to goes unchallenged, the helpful contributors become drowned out and eventually leave from fatigue. So ignoring trolls is not enough if we want the friendly and useful conversations to continue. Ignoring hostile behaviour also sends the wrong signal to newcomers and casual observers: that this is not a community which cares about actively upholding good standards of behaviour. What's needed, IMO, is a difficult balance: there needs to be calm, low-volume, but firm response to instances of hostile behaviour, making clear by demonstration – especially to the people only observing the discussion – that such hostility is unwanted and not to be tolerated in our community. This is difficult to achieve, though, because if *lots* of people do it, the thread turns into a dogpile that is also unhelpful, and usually departs from civil and rational discussion quickly. All of this turns away more good people (again, often people who otherwise weeren't involved in the particular discussion), so is counter-productive. So my request is: Be selective, and be calm. Don't respond deep in an existing exchange, especially one where many others have already responded to that person. Be selective and only respond when yours will be one of the first in the thread. (And that's not a mandate to have a quick trigger :-) Don't keep responding in a series of exchanges; it makes your messages difficult for newcomers to tell apart from the voluminous noise of the troll. When responding to a troll, don't be inflammatory yourself – that is *exactly* what they seek, a continuation and escalation of the conflict. Point out exactly what you think they're doing wrong, simply and calmly, and don't go on at length. Keep the innocent reader in mind, don't care too much about the troll reading your response. To those who feel the need to “fight” the trolls: thank you for caring enough about the Python community to try to defend it. But I'm concerned that you tend to pour fuel on the flames yourself, and I hope you can work to avoid becoming the monster you fight. And, yes, I know bringing it up could be construed as stoking the flames ... but, well, silence = acquiescence and all that. Agreed. Thanks again. -- \“Intellectual property is to the 21st century what the slave | `\ trade was to the 16th.” —David Mertz | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Feedback on my python framework I'm building.
On 10/14/2012 08:48 AM, Roy Smith wrote: In article 507a3365$0$6574$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. But, trivial to implement as an extension :-) PEEK and POKE were intended to be used with memory mapped devices. Simplest example is the 6502 chip, which had no I/O bus -- it was all memory mapped. Want to change baud rate? poke a byte somewhere. These days, the only device I can think of that's usually memory mapped is the video. And few programs talk to it that way. Now, INP and OUT (or various similar names) were for doing port I/o. But I suspect that modern systems aren't going to let you do much of that either. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Feedback on my python framework I'm building.
On 2012-10-14 23:38, Dave Angel wrote: On 10/14/2012 08:48 AM, Roy Smith wrote: In article 507a3365$0$6574$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. But, trivial to implement as an extension :-) PEEK and POKE were intended to be used with memory mapped devices. Simplest example is the 6502 chip, which had no I/O bus -- it was all memory mapped. Want to change baud rate? poke a byte somewhere. These days, the only device I can think of that's usually memory mapped is the video. And few programs talk to it that way. Now, INP and OUT (or various similar names) were for doing port I/o. But I suspect that modern systems aren't going to let you do much of that either. It depends on the CPU. Some have specialised instructions for I/O, others don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On Oct 14, 3:39 pm, Dwight Hutto dwightdhu...@gmail.com wrote: I'm not a know it all, but when attacked personally I defend myself, and those can turn into flame wars. I'm not wanting this to turn into another round of flames, but I do want to highlight that there's a big difference between being asked to moderate your language on a public list and a personal attack. Your plonks are irrelevant These things can get nasty quick. So if you have virgin eyes, then kill file it If you want it, bring it Posturing like this doesn't help either and starts to fall into the aggressive language territory this thread is concerned with. -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble with nested closures: one of my variables is missing...
On Sun, Oct 14, 2012 at 3:54 PM, Cameron Simpson c...@zip.com.au wrote: | You assign to it, but there's no nonlocal declaration, so Python thinks | it's a local var, hence your error. But 'unset_object' is in locals(). Why one and not the other? Obviously there's something about closures here I'm missing. 'unset_object' is in locals because it's a free variable and those are included in locals(), and it has a value. 'attr_name' is not in locals because while it's a local variable, it has not been assigned to yet. It has no value and an attempt to reference it at that point would result in an UnboundLocalError. -- http://mail.python.org/mailman/listinfo/python-list
Re: Understanding http proxies
On 13Oct2012 20:43, Olive di...@bigfoot.com wrote: | I am trying to understand how to build an http proxy server in python, | and I have found the following example: | http://www.oki-osk.jp/esc/python/proxy/ | | But I do not have found an exact description of what exactly a proxy | server is suppose to do (all references gice only the basic principe of | proxy that I know). In the following model | | Client - Proxy - Server | | it seems when I read the code above that the proxy acts mostly as an | orinary server with respect to the client except that it is supposed to | receive the full URL instead of just the path. Am I right? Is there any | documentation on what an http proxy is supposed to implement. As mentioned elsewhere, in HTTP 1.0 you get a full URL in the opening line. In HTTP 1.1 you get the path component in the opening line and the host part in the Host: header of the request. Have a read of RFC2616 (which defines HTTP 1.0): http://tools.ietf.org/html/rfc2616 It has sections on proxies, too, outlining which they must do beyond what a plain HTTP server must do (not much, but a few things, and there are proxy-specific authentication fields available too): Proxy Servers http://tools.ietf.org/html/rfc2616#section-8.1.3 Proxy Authenticate http://tools.ietf.org/html/rfc2616#section-14.33 Cheers, -- Cameron Simpson c...@zip.com.au There's two kinds of climbers...smart ones, and dead ones. - Don Whillans -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble with nested closures: one of my variables is missing...
On 14Oct2012 18:32, Ian Kelly ian.g.ke...@gmail.com wrote: | On Sun, Oct 14, 2012 at 3:54 PM, Cameron Simpson c...@zip.com.au wrote: | | You assign to it, but there's no nonlocal declaration, so Python thinks | | it's a local var, hence your error. | | But 'unset_object' is in locals(). Why one and not the other? | Obviously there's something about closures here I'm missing. | | 'unset_object' is in locals because it's a free variable and those are | included in locals(), and it has a value. | | 'attr_name' is not in locals because while it's a local variable, it | has not been assigned to yet. It has no value and an attempt to | reference it at that point would result in an UnboundLocalError. Can you elaborate a bit on that? The only place in my code that unset_object is set is as a default parameter in make_file_property (snippet): def make_file_property(attr_name=None, unset_object=None, poll_rate=1): print sys.stderr, make_file_property(attr_name=%r, unset_object=%r, poll_rate=%r): locals()=%r % (attr_name, unset_object, poll_rate,locals()) def made_file_property(func): print sys.stderr, made_file_property(func=%r): locals()=%r % (func, locals()) if attr_name is None: attr_name = '_' + func.__name__ and attr_name is set there also. Is attr_name omitted from locals() in made_file_property _because_ I have an assignment statement? If that's the case, should I be doing this (using distinct names for the closure variable and the function local variable): def make_file_property(attr_name=None, unset_object=None, poll_rate=1): print sys.stderr, make_file_property(attr_name=%r, unset_object=%r, poll_rate=%r): locals()=%r % (attr_name, unset_object, poll_rate,locals()) def made_file_property(func): print sys.stderr, made_file_property(func=%r): locals()=%r % (func, locals()) if attr_name is None: my_attr_name = '_' + func.__name__ else: my_attr_name = attr_name lock_name = my_attr_name + '_lock' def getprop(self): with getattr(self, lock_name): pass return getattr(self, my_attr_name, unset_object) i.e. deliberately _not_ assigning to attr_name as as to _avoid_ masking the outer attr_name from the inner locals()? BTW, doing that works. Is that The True Path for this situation? If so, I think I now understand what's going on: Python has inspected the inner function and not placed the outer 'attr_name' into locals() _because_ the inner function seems to have its own local attr_name in use, which should not be pre-tromped. -- Cameron Simpson c...@zip.com.au Nothing is so smiple that it can't get screwed up. -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble with nested closures: one of my variables is missing...
On Sun, Oct 14, 2012 at 7:08 PM, Cameron Simpson c...@zip.com.au wrote: On 14Oct2012 18:32, Ian Kelly ian.g.ke...@gmail.com wrote: | 'attr_name' is not in locals because while it's a local variable, it | has not been assigned to yet. It has no value and an attempt to | reference it at that point would result in an UnboundLocalError. Can you elaborate a bit on that? The only place in my code that unset_object is set is as a default parameter in make_file_property (snippet): def make_file_property(attr_name=None, unset_object=None, poll_rate=1): print sys.stderr, make_file_property(attr_name=%r, unset_object=%r, poll_rate=%r): locals()=%r % (attr_name, unset_object, poll_rate,locals()) def made_file_property(func): print sys.stderr, made_file_property(func=%r): locals()=%r % (func, locals()) if attr_name is None: attr_name = '_' + func.__name__ and attr_name is set there also. Is attr_name omitted from locals() in made_file_property _because_ I have an assignment statement? Yes. Syntactically, a variable is treated as local to a function if it is assigned to somewhere in that function and there is no explicit global or nonlocal declaration. If that's the case, should I be doing this (using distinct names for the closure variable and the function local variable): def make_file_property(attr_name=None, unset_object=None, poll_rate=1): print sys.stderr, make_file_property(attr_name=%r, unset_object=%r, poll_rate=%r): locals()=%r % (attr_name, unset_object, poll_rate,locals()) def made_file_property(func): print sys.stderr, made_file_property(func=%r): locals()=%r % (func, locals()) if attr_name is None: my_attr_name = '_' + func.__name__ else: my_attr_name = attr_name lock_name = my_attr_name + '_lock' def getprop(self): with getattr(self, lock_name): pass return getattr(self, my_attr_name, unset_object) i.e. deliberately _not_ assigning to attr_name as as to _avoid_ masking the outer attr_name from the inner locals()? BTW, doing that works. Is that The True Path for this situation? That's a perfectly good way to do it as long as you don't want to actually change the value of the outer attr_name. If you did, then you would either declare the variable as nonlocal (Python 3.x only) or use a container (e.g. a 1-element list), which would allow you to modify the contents of the container without actually assigning to the variable. If so, I think I now understand what's going on: Python has inspected the inner function and not placed the outer 'attr_name' into locals() _because_ the inner function seems to have its own local attr_name in use, which should not be pre-tromped. Exactly right. -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble with nested closures: one of my variables is missing...
On 14Oct2012 19:27, Ian Kelly ian.g.ke...@gmail.com wrote: | On Sun, Oct 14, 2012 at 7:08 PM, Cameron Simpson c...@zip.com.au wrote: | Is attr_name omitted from locals() in made_file_property _because_ I | have an assignment statement? | | Yes. Syntactically, a variable is treated as local to a function if | it is assigned to somewhere in that function and there is no explicit | global or nonlocal declaration. Aha. Good. | If that's the case, should I be doing this (using distinct names for the | closure variable and the function local variable): | |def make_file_property(attr_name=None, unset_object=None, poll_rate=1): [...] |if attr_name is None: | my_attr_name = '_' + func.__name__ |else: | my_attr_name = attr_name [...] | i.e. deliberately _not_ assigning to attr_name as as to _avoid_ masking | the outer attr_name from the inner locals()? | | BTW, doing that works. Is that The True Path for this situation? | | That's a perfectly good way to do it as long as you don't want to | actually change the value of the outer attr_name. Well, I don't need to - using a distinct local variable will do the job. I just hadn't realised I needed the extra level of naming. | If you did, then | you would either declare the variable as nonlocal (Python 3.x only) ... which is why I couldn't find such in the 2.7.3 doco ... | or | use a container (e.g. a 1-element list), which would allow you to | modify the contents of the container without actually assigning to the | variable. Ah. Yeah, tacky; I've done that kind of thing in the past on occasion but using a distinct local name is much cleaner here, and probably usually. | If so, I think I now understand what's going on: Python has inspected | the inner function and not placed the outer 'attr_name' into locals() | _because_ the inner function seems to have its own local attr_name | in use, which should not be pre-tromped. | | Exactly right. Thanks for the explaination. Now I know a New Thing. Cheers, -- Cameron Simpson c...@zip.com.au Vy can't ve chust climb? - John Salathe -- http://mail.python.org/mailman/listinfo/python-list
Can't run any script without it failing due to calling tkinter for no reason
Hello All, I'm running python 3.2 on Freebsd 9.0 Release and I must've screwed up my environment somehow, because now I can't run any script without it failing and throwing: ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** Yet none of my scripts use tkinter nor call that module. They're simple network scraping scripts. I use pydev and eclipse and must've fat fingered something that screwed up my python environment, but I haven't the slightest clue on how to fix it. I can run my scripts in idle no problem, but I've built them as command line apps. I've tried uninstalling python 3 and reinstalling it to no avail. What did I do, and how can I fix it? Thanks, Adam -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
: On 14 October 2012 17:58, Ben Finney ben+pyt...@benfinney.id.au wrote: What's needed, IMO, is a difficult balance: there needs to be calm, low-volume, but firm response to instances of hostile behaviour, making clear by demonstration – especially to the people only observing the discussion – that such hostility is unwanted and not to be tolerated in our community. Yep. I also think such responses are more effective coming from people who already have some weight[1] around here (which was part of the reason I was hesitant to bring it up myself). Good to see a few names I'd put in that bracket appear in this thread :-) -[]z. [1] Who are you calling fat? replies in 3, 2 ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Can't run any script without it failing due to calling tkinter for no reason
On Sun, Oct 14, 2012 at 6:47 PM, pythonuse...@gmail.com wrote: Hello All, I'm running python 3.2 on Freebsd 9.0 Release and I must've screwed up my environment somehow, because now I can't run any script without it failing and throwing: ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** Yet none of my scripts use tkinter nor call that module. They're simple network scraping scripts. I use pydev and eclipse and must've fat fingered something that screwed up my python environment, but I haven't the slightest clue on how to fix it. I can run my scripts in idle no problem, but I've built them as command line apps. I've tried uninstalling python 3 and reinstalling it to no avail. What did I do, and how can I fix it? Thanks, Adam -- IDLE uses Tkinter. If you don't have Tk installed, just run the scripts from the terminal or pick a different IDE. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/13/2012 09:46 AM, Etienne Robillard wrote: OT. you obviously has no clue what agressive behavior mean. :-) So please continue with the passive tone saying nothing relevant and login to facebook. There's a saying in English. Hit pigeons flutter. I have not been impressed with your last few posts. In fact your last couple of posts have been irrelevant and unhelpful to say the least. As you are looking for a maintainer to take over your django add-on project, such an attitude is not going to attract developers to take over your baby. Some of this could be the language barrier, but really such posturing isn't necessary. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can't run any script without it failing due to calling tkinter for no reason
On Sunday, October 14, 2012 7:19:24 PM UTC-7, Benjamin Kaplan wrote: On Sun, Oct 14, 2012 at 6:47 PM, pythonuse...@gmail.com wrote: Hello All, I'm running python 3.2 on Freebsd 9.0 Release and I must've screwed up my environment somehow, because now I can't run any script without it failing and throwing: ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** Yet none of my scripts use tkinter nor call that module. They're simple network scraping scripts. I use pydev and eclipse and must've fat fingered something that screwed up my python environment, but I haven't the slightest clue on how to fix it. I can run my scripts in idle no problem, but I've built them as command line apps. I've tried uninstalling python 3 and reinstalling it to no avail. What did I do, and how can I fix it? Thanks, Adam -- IDLE uses Tkinter. If you don't have Tk installed, just run the scripts from the terminal or pick a different IDE. Hi Ben, Your reply instantly triggered my aha moment and I figured it out. I had an import to idlelib in one of my modules dependencies from an eclipse auto-import. I feel foolish for not seeing it sooner. I use eclipse and pydev and use a module to do all the heavy network code for my front end command line scripts. In that module I used a function variable called host where eclipse, oh so helpfully, gave me the option of resolving an import I never asked for by automatically importing some module from idlelib. It was from idlelib import host as HOST or something to that effect. Damn eclipse does that to me from time to time and it happens so fast I don't even see what it does. Thanks for the reply and helping me see my erroneous ways. Cheers, Adam -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/14/2012 03:58 PM, Ben Finney wrote: Zero Piraeus sche...@gmail.com writes: [...] What's needed, IMO, is a difficult balance: there needs to be calm, low-volume, but firm response to instances of hostile behaviour, making clear by demonstration – especially to the people only observing the discussion – that such hostility is unwanted and not to be tolerated in our community. [...] The problem with this is that while there may sometimes be a weak consensus, different people have different ideas about what is wrong. Thus when a member of this esteemed group was recently attacked as racist, for punning another member's name when responding somewhat heatedly, I, according to your view, should have jumped in to point out unfair accusations of racism are not only wrong, but hurt the cause of anti-racism by devaluing such charges when they are legitimate. No, what you propose will only reduce the signal to noise ratio and increase the amount of off-topic arguments. The old tried-and-true advise is still the best: don't feed the trolls. Experience with three decades of mailing lists and usenet has shown that most of them give up and go somewhere else when they don't get a response. Of course this does not apply when you are the one attacked (or perceive you are) -- in that case your advice for a low-key factual response is quite appropriate. (And then drop it.) To those who feel the need to “fight” the trolls: thank you for caring enough about the Python community to try to defend it. But I'm concerned that you tend to pour fuel on the flames yourself, and I hope you can work to avoid becoming the monster you fight. And, yes, I know bringing it up could be construed as stoking the flames ... but, well, silence = acquiescence and all that. Agreed. Thanks again. No. Silence != acquiescence as a few minutes of thought will show. The fact that it is often repeated does not make it true. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On Oct 15, 1:22 pm, ru...@yahoo.com wrote: Thus when a member of this esteemed group was recently attacked as racist, for punning another member's name when responding somewhat heatedly, Again, there is a difference between attacking someone as racist and *criticising* their *comments* as *possibly* racist. When the person whose name was being punned said that they themselves were unsure whether it was intended as a racial attack, then the behaviour was worth commenting on. If anything, I initially *joked* about it as a means of trying to point out the issue in a non-offensive way. If there was any attacking going on, it was in the criticised party's responses. hurt the cause of anti-racism My response had nothing to do with agendas and causes and everything to do with wanting to keep specific forms of discourse off this list. I had identical issues with the same person's use of bitch and whore; I cannot begin to fathom how stating that they're unacceptable to use here is in any way damaging to the anti-sexism position, or an attack on the person saying them. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyw program not displaying unicode characters properly
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: On Sun, 14 Oct 2012 19:19:33 +0200, Alain Ketterlin wrote: Usenet has no attachments. *snarfle* You almost owed me a new monitor. I nearly sprayed my breakfast all over it. [...] I owe you nothing, and you can do whatever you want with your breakfast. Usenet has no attachments -- that's like saying that the Web has no advertisements. Maybe the websites you visit have no advertisements, but there's a *vast* (and often disturbing) part of the WWW that has advertisements, some sites are nothing but advertisements.[...] I really don't know what you are ranting about here. See Dennis' response. Any idea about a reasonable complete unicode font on Windows? /That/ would be helpful. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list
Re: Basic JSON question: Do I really need the quotes
On Friday, 12 October 2012 16:09:14 UTC+2, (unknown) wrote: Hi, I need to define some configuration in a file that will be manually created. Internally, the data will be stored as a dict, which contains various properties related to a design e.g. Design Name, dependencies, lists of files (and associated libraries). json seemed a quick an easy way of achieving this Anyway, in simple terms my question - if I know everything is a string, how can I omit the quotation marks? i.e. I can do json.loads('{mykey:[data0, data1]}') {u'mykey': [u'data0', u'data1']} But I would like to do json.loads('{mykey:[data0, data1]}') Traceback (most recent call last): The problem is that I don't want to make users have to type redundant characters. Is it possible? Thanks, Steven Hi, Thanks to everyone for the responses. I'll look at YAML and ConfigParser. Steven -- http://mail.python.org/mailman/listinfo/python-list
[issue16224] tokenize.untokenize() misbehaves when moved to compatiblity mode
New submission from Eric Snow: When tokenize.untokenize() encounters a 2-tuple, it moves to compatibility mode, where only the token type and string are used from that point forward. There are two closely related problems: * when the iterable is a sequence, the portion of the sequence prior to the 2-tuple is traversed a second time under compatibility mode. * when the iterable is an iterator, the first 2-tuple encountered is essentially gobbled up (see issue16221). Either an explicit iterable = iter(iterable) or iterable = list(iterable) should happen at the very beginning of Untokenizer.untokenize(). If the former, Untokenizer.compat() should be fixed to not treat that first token differently. If the latter, self.tokens should be cleared at the beginning of Untokenizer.compat(). I'll put up a patch with the second option when I get a chance. -- assignee: eric.snow components: Library (Lib) messages: 172851 nosy: eric.snow priority: normal severity: normal stage: test needed status: open title: tokenize.untokenize() misbehaves when moved to compatiblity mode type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16221] tokenize.untokenize() compat mode misses the encoding when using an iterator
Eric Snow added the comment: issue16224 _may_ supercede this ticket. -- components: +Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16221 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16224] tokenize.untokenize() misbehaves when moved to compatiblity mode
Eric Snow added the comment: Actually, here's a patch with the first option. It preserves iterators as iterators, rather than dumping them into a list. I've also rolled the tests from issue16221 into this patch. Consequently, if the patch is suitable, that issue can be closed. -- keywords: +patch stage: test needed - patch review Added file: http://bugs.python.org/file27560/untokenize_compat_force_iter.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16221] tokenize.untokenize() compat mode misses the encoding when using an iterator
Eric Snow added the comment: The patch that I have in #16224 takes care of this issue. If that issue goes in another direction however... -- status: open - pending superseder: - tokenize.untokenize() misbehaves when moved to compatiblity mode ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16221 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16225] list.remove in for loop
New submission from Ian Carr-de Avelon: I'm new to Python and I've hit what appears to me to be a bug, but may be a feature, so a tutorial bug. I tried to loop through the items in a list, test each and remove those which fail the test. Simplifying to illustrate: print test [1, 2, 3, 4, 5] for item in test: ... print item ... test.remove(item) ... 1 3 5 print test [2, 4] Whereas I would expect to see all items looped through and non left in the list. I have worked with languages where you are explicitly warned that you must not mess with the loop variable, or where the behaviour you will get is explained in detail, so you can use it. Not having anything flagged up in eg 5.6. Looping Techniques on http://docs.python.org/tutorial/datastructures.html I assumed that the behaviour would be safe and intuative. Yours Ian -- messages: 172855 nosy: Ian priority: normal severity: normal status: open title: list.remove in for loop versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16225 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16225] list.remove in for loop
Chris Jerdonek added the comment: I have worked with languages where you are explicitly warned that you must not mess with the loop variable There is a warning in this part of the tutorial: It is not safe to modify the sequence being iterated over in the loop... (from http://docs.python.org/dev/tutorial/controlflow.html#for-statements ) But it may be good to add a note to the section you reference as well. -- assignee: - docs@python components: +Documentation nosy: +chris.jerdonek, docs@python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16225 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Charles-François Natali added the comment: You can't use longjmp from signal handlers. Well, you can, but 99% of the code that does it is broken, because you can only call async-safe functions from within a signal handler, and certainly can't run the intepreter. I don't see the reason to run the interpreter. But a quick look at the source shows that the current implementation already uses longjmps to handle SIGFPE (see pyfpe.h and fpectlmodule.c). It seems to be in use on many platforms. The only problem I see so far is the possibility that we have to protect too much. However, as I could guess from quickly browsing through the mmap() implementation, the address of the mmap()ed region never leaves the module, all accesses are done using exported methods. If it is really the case, we can wrap them into something similar to PyFPE_START_PROTECT() and PyFPE_END_PROTECT() (see comments in pyfpe.h). SIGFPE is not handled by default (it's not generated by default, you get NaN and friends). I don't think there a re many uses of the fpe module, because it's inherently unsafe. For example, in our case, let's say you want to protect mmap_item(): what do you in case of SIGBUS? Use longjmp to jump out of the signal handler and raise an exception? That won't work, because you'll still be running on behalf of the signal handler, so as soon as you call a non async safe function (or non reentrant code), you'll deadlock, crash, or suffer from all the consequences of undefined behavior, which is much more dangerous than crashing on a SIGBUS. The *only* thing you can do is exit. Please have a look at this: https://www.securecoding.cert.org/confluence/display/seccode/SIG35-C.+Do+not+return+from+SIGSEGV,+SIGILL,+or+SIGFPE+signal+handlers https://www.securecoding.cert.org/confluence/display/seccode/SIG32-C.+Do+not+call+longjmp%28%29+from+inside+a+signal+handler A pity Posix isn't smart enough to refuse truncate()ing when there's a mmap open on the affected pages. Python 3's buffer API is superior in that respect :-) Yes, but Python only cares about the current process. Here the exact same problem occurs if the file is truncated by another process: performing such checks for all the processes would be awfuly expensive (and probably impossible in a race-free way). Also, it's probably impossible to do on e.g. NFS mmaped files (the server is stateless). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16220] wsgiref does not call close() on iterable response
Brent Tubbs added the comment: Patch attached. I ran into this while trying to figure out why close() wasn't being called while running the Django dev server, which inherits from wsgiref's BaseHandler. So I'm also surprised that it's gone unnoticed so long. Thanks for the quick attention and encouragement on this! -- keywords: +patch Added file: http://bugs.python.org/file27561/wsgiref_close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15819] Unable to build Python out-of-tree when source tree is readonly.
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15819 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
STINNER Victor added the comment: I've found a few examples of handling non-restartable signals with longjmps, but not that familiar with the codebase to estimate how reliably it can be done on all supported platforms. I don't really know how this code would behave, say, on Windows. I proposed a generic signal handler for SIGSEGV (SIGFPE, SIGILL and SIGBUS) converting the fatal signal to a classic Python exception: issue issue #3999. The idea was rejected by most core developers because it's just impossible to guarantee that Python internal structures are still consistent. A signal can occur anywhere, the longjmp() will skip all cleanup instructions and so it's easy to get into a deadlock case. So I proposed to display a Python traceback on such signal and just exit. For your specific case, it would much better if the kernel handles the case. I thought that the possibility to crash the interpreter is something to be avoided at all costs. It's quite easy to crash Python using extensions implemented in C. A simple example: ctypes.string_at(0). For your specific case, you should develop an extension which sets a signal handler before reading the mmap and then restore the old signal handler after. It might be safe if the signal handler protects a single instruction, but it's very hard to develop a signal handler for such critical signals (SIGSEGV and friends). I suggest to just close this issue as wont fix. Python cannot do anything useful in a safe manner against this OS bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Vladimir Ushakov added the comment: SIGBUS as well as SIGFPE or SIGSEGV is a synchronous signal. It is delivered to the thread that caused the trouble and the stack contents is well defined. https://www.securecoding.cert.org/confluence/display/seccode/SIG35-C.+Do+not+return+from+SIGSEGV,+SIGILL,+or+SIGFPE+signal+handlers Does not apply here: longjmp is not a return. https://www.securecoding.cert.org/confluence/display/seccode/SIG32-C.+Do+not+call+longjmp%28%29+from+inside+a+signal+handler The grounds are weak. They refer to SIG30-C, which is based on ISO C standard. POSIX explicitly declares the fact that longjmp is allowed to exit signal handlers as an extension to ISO C standard. (See http://pubs.opengroup.org/onlinepubs/9699919799/) Besides, POSIX explicitly states that only async-signal-safe functions can be called from the handlers, which are invoked asynchronously with process execution. That's not out case as mentioned above, we are not in asynchronous context as it could be with, say, SIGINT. (See http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html) Glibc doesn't mind as well: http://www.gnu.org/software/libc/manual/html_node/Longjmp-in-Handler.html I can doubt about non-POSIX platforms, but with POSIX everything seems clean to me. Especially since the method is already in use with SIGFPE. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16225] list.remove in for loop
Chris Jerdonek added the comment: Attached is a simple way of addressing this (essentially copying the verbiage and example from the other page). If we want, we could make the sample code different so that the reader doesn't see the same thing twice. -- keywords: +patch stage: - patch review Added file: http://bugs.python.org/file27562/issue-16225-1-default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16225 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Vladimir Ushakov added the comment: For your specific case, you should... There's nothing I should. As I said above, the bug doesn't trouble me. I just posted it as a generic contribution and don't really care whether it's going to be fixed or not. If decided so, I could help. Otherwise I'll just mind my business. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16226] IDLE crashes on *File / Path browser*
New submission from Francisco Gracia: The menu option *File / Path browser* (as well in the *Shell* window as in the *Editor* one) shows a new window with a tree structure rooted at *sys.path*. The available leaf nodes show the *plus* sign that usually implies that they can be expanded by clicking on the desired one. On the performance of this action IDLE disappears immediately. If one clicks just on the legend of the node, IDLE remains undisturbed but nothing more happens. Idle's help says: *File Menu: ... Path Browser -- Show sys.path directories, modules, classes and methods* so that apparently the expansion should also work. I suppose that this command would be mostly used at the initial phases of learning Python (at least I would have done it if I had noticed then its existence and function), but its present status does not favor such didactic purpose. Regards -- components: IDLE messages: 172863 nosy: fgracia priority: normal severity: normal status: open title: IDLE crashes on *File / Path browser* type: crash versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16226 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Vladimir Ushakov added the comment: ...it's just impossible to guarantee that Python internal structures are still consistent. In generic case, I completely agree. Here the things are much simpler (unless I missed something). We know perfectly well the code we need to protect (mmap accessors). We can make the protected sections small enough to ensure that no internal state gets corrupted. I just feel, I can do it simply and safely. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
New submission from Mark Lawrence: For http://docs.python.org/howto/unicode.html (that's Python 2.7.3) and http://docs.python.org/release/3.1.5/howto/unicode.html the first paragraph states (This HOWTO has not yet been updated to cover the 3.x versions of Python.). I suggest this is changed to read something like Release 1.12 onwards of this document covers the 3.2 Python versions onwards. -- assignee: docs@python components: Documentation messages: 172865 nosy: BreamoreBoy, docs@python priority: normal severity: normal status: open title: Change unicode howtos as misleading type: enhancement versions: Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Vladimir Ushakov added the comment: Update: The correct link to the POSIX definition of longjmp exiting a signal handler as an ISO C extension is http://pubs.opengroup.org/onlinepubs/9699919799/functions/longjmp.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16228] JSON crashes during encoding resized lists
New submission from Serhiy Storchaka: JSON encoding crash if the source list resized in process of encoding. This can be happen unintentionally in multithreaded code. Simple crash code: import json a = [object()] * 10 def crasher(obj): del a[-1] json.dumps(a, default=crasher) -- components: Extension Modules messages: 172867 nosy: bob.ippolito, ezio.melotti, pitrou, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: JSON crashes during encoding resized lists type: crash versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16229] Module *redemo.py* lacking in recent Python distributions
New submission from Francisco Gracia: Since Python 3.2 the module *redemo.py* is lacking in the official Python distributions. The excellent and extremely useful *Regular expressions HOWTO* of 3.2.x and 3.3 keep however referring to it (although referring to the wrong path *Tools/demo/* instead of *Tools/Scripts/*) and the same does the *README* file. I just copied the version of the module distributed with 3.1 and it keeps working as well with 3.2.x as with 3.3.0 without having experienced any problems. Is there any justification for this situation or is it just a slip? Regards -- components: Demos and Tools messages: 172868 nosy: fgracia priority: normal severity: normal status: open title: Module *redemo.py* lacking in recent Python distributions versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16229 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16228] JSON crashes during encoding resized lists
Serhiy Storchaka added the comment: Here is a patch. -- keywords: +patch Added file: http://bugs.python.org/file27563/json_encode_resized_list.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Chris Jerdonek added the comment: I wonder why the note must be there at all. None of the 2.x docs have been updated to cover the 3.x versions of Python. Otherwise, every 2.x page could use such a disclaimer. Here is where the note was added: http://hg.python.org/cpython/rev/bdef454f7212 -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14039] Add metavar argument to add_subparsers() in argparse
Changes by Berker Peksag berker.pek...@gmail.com: -- versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14039 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16230] select.select crashes on resized lists
New submission from Serhiy Storchaka: Simple crash code: import select a = [] class F: def fileno(self): del a[-1] return 1 a[:] = [F()] * 10 select.select([], a, []) -- components: Extension Modules messages: 172871 nosy: serhiy.storchaka priority: normal severity: normal status: open title: select.select crashes on resized lists type: crash versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16230 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16230] select.select crashes on resized lists
Serhiy Storchaka added the comment: Here is a patch. -- keywords: +patch Added file: http://bugs.python.org/file27564/select_resized_list.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16230 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Mark Lawrence added the comment: I'd happily settle on seeing this historical note removed from the 2.7.3 docs. I'm unsure about the best approach for 3.1.5. Who's done the most work on unicode to answer this one, someone working on #16061 possibly? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10050] urllib.request still has old 2.x urllib primitives
Nadeem Vawda added the comment: Hmm, OK. URLopener and FancyURLopener do each issue a DeprecationWarning when used, though. If they are not actually deprecated, perhaps we should remove the warnings for the moment? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10050 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16225] list.remove in for loop
Serhiy Storchaka added the comment: It is safe to modify a sequence during iteration if it's size not increased. words = ['cat', 'window', 'defenestrate'] for i, w in enumerate(words): ... if len(w) 6: ... words[i] = w[:5] + '…' ... words ['cat', 'window', 'defen…'] -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16225 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6559] add pass_fds paramter to subprocess.Popen()
Serhiy Storchaka added the comment: _posixsubprocess.fork_exec docstring was not updated. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6559 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14913] tokenize the source to manage Pdb breakpoints
Xavier de Gaye added the comment: Attached patch pdb_lnotab.patch uses lnotabs (see Objects/lnotab_notes.txt) to find the actual breakpoint line number and parses the module source with tokenize to find the set of function and fully qualified method names in a module. The patch fixes issues 6322, 14789, 14792, 14795, 14808. The local trace function is only set on functions where a breakpoint is set, this provides a significant performance improvement. -- Added file: http://bugs.python.org/file27565/pdb_lnotab.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14913 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6322] Pdb breakpoints don't work on lines without bytecode
Xavier de Gaye added the comment: This is fixed in the proposed patch named pdb_lnotab.patch attached to issue 14913. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10050] urllib.request still has old 2.x urllib primitives
Ezio Melotti added the comment: See also #12707. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10050 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16044] xml.etree.ElementTree.Element: append method iterator param is broken
Eli Bendersky added the comment: Closing, since this isn't a bug and append's behavior is properly documented. Regarding the error message, yes it could probably be better but you would need to enable input validation for that. Since Python is duck typed, often when arguments are not validated you get less-than-good error messages if things go wrong. In this case, append expect something Element-like that would have an iter method, and complains when that's not found. In 3.3 this whole thing was improved by always validating arguments in append/extend etc. and raising a TypeError when something is wrong. I don't think there's good enough reason to change this in 2.7 -- stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16044 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO
Changes by Eli Bendersky eli...@gmail.com: -- title: Optimize BytesIO to so less reallocations when written, similarly to StringIO - Optimize BytesIO to do less reallocations when written, similarly to StringIO ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15381 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12321] documentation of ElementTree.find
Changes by Eli Bendersky eli...@gmail.com: Removed file: http://bugs.python.org/file22406/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12321] documentation of ElementTree.find
Changes by Eli Bendersky eli...@gmail.com: -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12321] documentation of ElementTree.find
Eli Bendersky added the comment: I think this may be intentional. Absolute searches on a ElementTree are discouraged with a warning: def find(self, path, namespaces=None): # assert self._root is not None if path[:1] == /: path = . + path warnings.warn( This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %r % path, FutureWarning, stacklevel=2 ) return self._root.find(path, namespaces) See what happens when an absolute path is attemped? The code just hacks it into a relative path and prints a menacing warning. So, I would not change the documentation at this point. However, the problem should go away if and when the XPath support is improved to really support absolute paths. -- resolution: - wont fix stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16202] sys.path[0] security issues
Changes by hasufell julian.osp...@googlemail.com: -- nosy: +hasufell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16202 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15442] Expand the list of default dirs filecmp.dircmp ignores
Eli Bendersky added the comment: moijes12, why are the added names raw ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15442 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15721] PEP 3121, 384 Refactoring applied to tkinter module
Roundup Robot added the comment: New changeset bf9d118779f5 by Andrew Svetlov in branch 'default': Issue #15721: make _tkinter module pep384 compatible. http://hg.python.org/cpython/rev/bf9d118779f5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Martin v. Löwis added the comment: I don't think there is a need to update the 3.1.x version of the documentation in that respect. -- nosy: +loewis versions: +Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Martin v. Löwis added the comment: Before the disclaimer can be removed, all statements of the document should be reviewed. From a shallow glance, the section on Python 2.x's support should be changed to Python's support. The reference to Marc-Andre Lemburg's presentation should be removed, as it's not current anymore. The 2.7 version of the document is fine as it stands; it indeed doesn't talk about 3.x. -- versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Mark Lawrence added the comment: See also #4153 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16227] Change unicode howtos as misleading
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Unicode nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16227 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16231] pickle persistent_id return value
New submission from PSchaafsma: The documentation of persistent_id prescribes that returning None will cause default pickling behavior. This makes sense. However, in the Pickler.save function in pickle.py, the return value of persistent_id checked as boolean, causing also return values like 0 and [] to indicate default pickling. This becomes a problem when unpickleable objects are identified by a simple index in some other list. -- components: Library (Lib) messages: 172887 nosy: pschaafsma priority: normal severity: normal status: open title: pickle persistent_id return value type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16231 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16232] curses.textpad.Textbox backtrace support
New submission from emeaudroid emeaudroid: python: 2.6.6 curses' revision: 61064 2008-02-25 16:29:58Z andrew.kuchling line 93 and 102 of curses/textpad.py could you replace the backspace's specific chars codes by using this dedicated curses' function retrieving the currently in-use char's code ? ord( curses.erasechar( )) this one would make specific erase char specified to term supported, unlike curses.ascii.BS, curses.KEY_BACKSPACE that are specifics to most configurations indeed. at least adding the curses.ascii.DEL char's code seems legit na ? -- components: Extension Modules messages: 172888 nosy: emeaudroid.emeaudroid priority: normal severity: normal status: open title: curses.textpad.Textbox backtrace support type: enhancement versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Charles-François Natali added the comment: SIGBUS as well as SIGFPE or SIGSEGV is a synchronous signal. It is delivered to the thread that caused the trouble and the stack contents is well defined. Except that signal handlers are per-process, not per thread. So if another thread (which could be running without the GIL, e.g. doing some lengthy computation) triggers a SIGBUS while the handler is setup, it's going to try to longjmp to the jmp_buf set by the other thread. And this will get really nasty. https://www.securecoding.cert.org/confluence/display/seccode/SIG35-C.+Do+not+return+from+SIGSEGV,+SIGILL,+or+SIGFPE+signal+handlers Does not apply here: longjmp is not a return. I still don't understand how you plan to handle the SIGBUS/SIGSEGV. Where will you longjmp to? If the idea is to dump a traceback and exit, then there's faulthandler for that. As for the stack content, variables with automatic storage class (i.e. local variables) modified should be declared volatile (which may or may not be an issue here). https://www.securecoding.cert.org/confluence/display/seccode/SIG32-C.+Do+not+call+longjmp%28%29+from+inside+a+signal+handler The grounds are weak. They refer to SIG30-C, which is based on ISO C standard. POSIX explicitly declares the fact that longjmp is allowed to exit signal handlers as an extension to ISO C standard. It is allowed, but as said earlier, 99% of use cases are just wrong. Besides, POSIX explicitly states that only async-signal-safe functions can be called from the handlers, which are invoked asynchronously with process execution. That's not out case as mentioned above, we are not in asynchronous context as it could be with, say, SIGINT. Well, nothing prevents kill -SEGV PID. Besides, setjmp() is expensive, and here we would be setting up a jmp_buf even for a single byte memory access. But I think we've talked enough :-) Honestly, if you manage to find a way to handle this, I'll be happy to commit it, so don't hesitate if you think you've found an approach that will work. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13454] crash when deleting one pair from tee()
Serhiy Storchaka added the comment: Here is a patch (tests included). Thank Pyry for report, Victor and Amaury for analysis. Maybe I picked up the poor names for iterators? May be exhausted and unexhausted would be better? Feel free to correct me. -- keywords: +patch nosy: +serhiy.storchaka stage: test needed - patch review versions: +Python 3.4 Added file: http://bugs.python.org/file27566/itertools_tee_nonrecursive_clear.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16233] IDLE: conceptual problems with *Class browser*
New submission from Francisco Gracia: The *File* option in the menu bar of both the Python shell and the program editor have an entry called *Class Browser*. If one selects it from the shell window, one gets always an error message with the title: No filename which says: This buffer has no associated filename. This happens whatever the previous history of the current interactive session. If one selects it from the editor window with a Python module loaded, then another window shows correctly the expected information about the classes defined in such a module, if any. The same previous error appears if the current contents of the editor are not recognised as a Python module (for instance by not having been yet saved), which is reasonable. IDLE's help says: Class Browser-- Show classes and methods in current file. This does not clarify things much (what does *current file* mean from the shell window?) and does not permit one to get a coherent idea of the purpose originally intended for the option (a module imported in the current interactive session could not be rightly understood as a *current file*?). I find this situation quite confuse and would suggest that some action could be taken in order to at least clarify it, if not improve it, as for instance (in order of desirability and --very likely-- difficulty): - Just make the error message less puzzling and more informative when coming from the shell window (what does *buffer* mean in this context?) and let the help file explain that this operation has only sense in connection with Python scripts being edited (if that is the case, as it seems). - Disable the option in the shell window. - Suppress the option in the shell window and keep it only in the editor window when the document it is handling is recognised as a Python module. - Keep the option also in the shell window and make it display information about the classes defined in the namespace of the current interactive session, if any. I think that this is what would be a real and useful *class browser*. Thank you in advance for your attention. -- components: IDLE messages: 172891 nosy: fgracia priority: normal severity: normal status: open title: IDLE: conceptual problems with *Class browser* type: enhancement versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16233 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16212] mmap() dumps core upon resizing the underlying file
Vladimir Ushakov added the comment: But I think we've talked enough... So do I. Let's go for it. I'll make a patch (which apparently takes some time) and post it here, we'll discuss it then. Thanks for your comments. Now I believe it's a bit harder than I thought initially, but still doable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16226] IDLE crashes on *File / Path browser*
Ned Deily added the comment: Thank you for the report. There does seem to be a regression in the 3.3 version of IDLE. Using the OS X version of bin/idle3.3 and selecting menu item File - Path Browser results in the following exception: Exception in Tkinter callback Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tkinter/__init__.py, line 1442, in __call__ return self.func(*args) File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 131, in expand self.update() File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 164, in update self.parent.update() File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 170, in update self.draw(7, 2) File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 197, in draw cy = child.draw(cx, cy) File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 184, in draw sublist = self.item._GetSubList() File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py, line 338, in _GetSubList sublist = self.GetSubList() File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PathBrowser.py, line 61, in GetSubList for nn, name in self.listmodules(names): File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PathBrowser.py, line 78, in listmodules for suff, mode, flag in suffixes: ValueError: too many values to unpack (expected 3) -- keywords: +3.3regression nosy: +ned.deily priority: normal - high stage: - needs patch versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16226 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16222] server-side clone not found by devguide's search box
Éric Araujo added the comment: Not sure this needs more exposure. New core developers will learn about that feature from other devs, and contributors (the primary audience of the devguide) can't use these repos. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16222 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16229] Module *redemo.py* lacking in recent Python distributions
Ned Deily added the comment: The demo scripts in the Tools directory were cleaned up earlier in Python 3 and moved. redemo.py is still included in the 3.2 and later source distributions in the Tools/demo directory. The builders of binary installers and third-party distributors of Python 3.x may make their own decisions about whether to include the Tools directory in their distros. For which platform and from what source are you installing Python 3.2? -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16229 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8425] a -= b should be fast if a is a small set and b is a large set
Changes by Terry J. Reedy tjre...@udel.edu: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8425 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16083] HTTPServer does not correctly handle bad headers
Terry J. Reedy added the comment: Is this really a security issue? If so, that should be explained. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16083 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16225] list.remove in for loop
Chris Jerdonek added the comment: It is safe to modify a sequence during iteration if it's size not increased. What do you mean by safe? The example given by the original commenter does not increase the size either. I believe safe is meant in the sense of avoiding possibly unexpected behavior. I can clarify the language if you feel it is ambiguous. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16225 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8786] Add support for IEEE 754 contexts to decimal module.
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16083] HTTPServer does not correctly handle bad headers
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16083 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com