Re: Is this the proper way to use a class method?
On Fri, Mar 2, 2012 at 12:16 AM, John Salerno johnj...@gmail.com wrote: That's just a coincidence. Your supercall is ought to be: super().move() In contrast, super().move(self) calls the superclass instance method `move` with 2 arguments, both `self`, which just happens to work given your move() method, inside which `cls` isn't actually a class like it ought to be. Thank you! This is the whole reason I tried using a class method in the first place. I was getting an error that said my move method only takes one argument, but I was passing in two. But if I make the super call as super().move(), how does that work? The move method in the superclass takes an argument, and if I just do super().move(), isn't it the subclass that's getting passed to it? The self that gets passed into the superclass.move() or the subclass.move() is the exact same object in either case. There is no up-casting (or any casting at all, for that matter) in Python. How does the superclass move method know what 'self' is if it doesn't get passed to it as I did originally? super() called without arguments is equivalent to super(class this method was defined in, self) -- it collects the value of self from the current stack frame. So self is able to be passed in because the super object implicitly knows what self is. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this the proper way to use a class method?
On Thu, Mar 1, 2012 at 11:16 PM, John Salerno johnj...@gmail.com wrote: That's just a coincidence. Your supercall is ought to be: super().move() In contrast, super().move(self) calls the superclass instance method `move` with 2 arguments, both `self`, which just happens to work given your move() method, inside which `cls` isn't actually a class like it ought to be. Thank you! This is the whole reason I tried using a class method in the first place. I was getting an error that said my move method only takes one argument, but I was passing in two. But if I make the super call as super().move(), how does that work? The move method in the superclass takes an argument, and if I just do super().move(), isn't it the subclass that's getting passed to it? The instance of the subclass (i.e. what Pawn.move() considers `self`) gets passed to it. How does the superclass move method know what 'self' is if it doesn't get passed to it as I did originally? Oh, but it does get passed, just implicitly. `super()` basically grabs `self` magically from its caller, and uses it to bind method calls on the magical object returned by `super()`. `super().move()` ends up being, in this particular case, equivalent to: ChessPiece.move(self) which is incidentally how one would write this without using super(). Here is a useful[1] identity to ponder: x.y(z) === type(x).y(x, z) Cheers, Chris -- [1]: In the sense of a useful lie[2]; it's far from completely accurate; it (at the least) ignores metaclasses, overridings of __getattribute__(), and a third thing that's difficult to clearly put into words. [2]: http://c2.com/cgi/wiki?UsefulLie [3] [3]: Yes, my footnotes have footnotes. http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Python Developer Job Opportunities
I have an opportunity for talented Python Developers with Django experience based in the South of the UK. I am recruiting for a funded new venture set up by two successful entrepreneurs who are experienced and well--respected scientists and mathematicians. They're building a new and radical way of learning Maths; an advanced technological platform (iPad / Cloud based) with unique data gathering and analysis capabilities the program will create a world beating, cutting edge product. They are on the hunt for Python developers to build the interface of a brand new cloud hosted web app that will be rolled out on iPad as well as a bespoke CMS, web portal and internal visualization platform. The team are working in brand new, expansive offices (45,000 square feet, free lunch, onsite gym, games room, poker room with casino grade tables, 5-A-Side football pitch). This is an exciting opportunity to become a core member of the development team in a growing company that will be providing a technical challenge in a fantastic working environment all in aid of a good cause. If you would like to discuss the role in more detail please contact me at matt.jo...@radiusrecruitment.co.ukmailto:matt.jo...@radiusrecruitment.co.uk I can also provide photos of the office, details on working environment etc. -- http://mail.python.org/mailman/listinfo/python-list
Re: lang comparison: in-place algorithm for reversing a list in Perl,Python, Lisp
Xah Lee wrote: «… One easy way to measure it is whether a programer can read and understand a program without having to delve into its idiosyncrasies. …» Chris Angelico wrote: «Neither the behavior of ints nor the behavior of IEEE floating point is a quirk or an idiosyncracy. …» they are computer engineering by-products. Are quirks and idiosyncracies. Check out a advanced lang such as Mathematica. There, one can learn how the mathematical concept of integer or real number are implemented in a computer language, without lots by-products of comp engineering as in vast majority of langs (all those that chalks up to some IEEE. (which, sadly, includes C, C++, java, perl, python, lisp, and almost all. (lisp idiots speak of the jargon “number tower” instead I.) (part of the reason almost all langs stick to some I stuff is because it's kinda standard, and everyone understand it, in the sense that unix RFC (aka really fucking common) is wide-spread because its free yet technically worst. (in a sense, when everybody's stupid, there arise a cost to not be stupid.. Xah -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
In 87k4341j0l@sapphire.mobileactivedefense.com, on 03/01/2012 at 02:40 PM, Rainer Weikusat rweiku...@mssgmbh.com said: You obviously don't have any sense of humour. Certainly I do; I laugh at pretentious loons with delusions of adequacy. -- Shmuel (Seymour J.) Metz, SysProg and JOAT http://patriot.net/~shmuel Unsolicited bulk E-mail subject to legal action. I reserve the right to publicly post or ridicule any abusive E-mail. Reply to domain Patriot dot net user shmuel+news to contact me. Do not reply to spamt...@library.lspace.org -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
On Mar 1, 3:00 am, Kiuhnm kiuhnm03.4t.yahoo.it wrote: They did not make up the terminology, if that is what you are saying. The concepts of left and right associativity are well-known and accepted in TCS (Theoretical CS). Aho, Sethi and Ullman explain it this way in Compilers: Principles, Techniques and Tools: We say that the operator + associates to the left because an operand with plus signs on both sides of it is taken by the operator to its left. [...] And they also show parse trees similar to the ones I wrote above. how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」? do you happen to know some site that shows the relevant page i can have a look? thanks. Xah On Mar 1, 3:00 am, Kiuhnm kiuhnm03.4t.yahoo.it wrote: On 3/1/2012 1:02, Xah Lee wrote: i missed a point in my original post. That is, when the same operator are adjacent. e.g. 「3 ▲ 6 ▲ 5」. This is pointed out by Kiuhnm 〔kiuhnm03.4t.yahoo.it〕 and Tim Bradshaw. Thanks. though, i disagree the way they expressed it, or any sense this is different from math. They did not make up the terminology, if that is what you are saying. The concepts of left and right associativity are well-known and accepted in TCS (Theoretical CS). If you change the terminology, no one will understand you unless you provide your definitions every time (and then they may not accept them). Another way of saying that an operator is left-associative is that its parse tree is a left-tree, i.e. a complete tree where each right child is a leaf. For instance, (use a monospaced font) 1 + 2 + 3 + 4 gives you this left-tree: + + 4 + 3 1 2 while 1**2**3**4 gives you this right-tree: ** 1 ** 2 ** 3 4 Aho, Sethi and Ullman explain it this way in Compilers: Principles, Techniques and Tools: We say that the operator + associates to the left because an operand with plus signs on both sides of it is taken by the operator to its left. [...] And they also show parse trees similar to the ones I wrote above. Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
On Thu, 01 Mar 2012 10:13:11 -0500, Shmuel (Seymour J.) Metz wrote: In DuD3r.21706$cl.12...@newsfe17.iad, on 03/01/2012 at 05:07 AM, Chiron chiron...@gmail.com said: Hmm... maybe, instead of just ridiculing him, I'm treating him as he treats others. OK. BTW, I happen to agree with you insofar as this poster not understanding the nature of mathematics. His comment reminds me of the article, Transgressing the Boundaries: Towards a Transformative Hermeneutics of Quantum Gravity A brilliant piece of work. I greatly enjoyed it and the reaction to its disclosure. What always gets me is how so many people criticized Sokal for doing it, instead of soundly condemning the editor for not bothering to verify what Sokal said. It's like the kid points out that the emperor has no clothes, so they shoot the kid. Of course, in real life, that's exactly what would happen, so I guess I shouldn't be too surprised... -- It is a hard matter, my fellow citizens, to argue with the belly, since it has no ears. -- Marcus Porcius Cato -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
On 3/2/2012 14:12, Xah Lee wrote: On Mar 1, 3:00 am, Kiuhnmkiuhnm03.4t.yahoo.it wrote: They did not make up the terminology, if that is what you are saying. The concepts of left and right associativity are well-known and accepted in TCS (Theoretical CS). Aho, Sethi and Ullman explain it this way in Compilers: Principles, Techniques and Tools: We say that the operator + associates to the left because an operand with plus signs on both sides of it is taken by the operator to its left. [...] And they also show parse trees similar to the ones I wrote above. how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」? The same way you do, I guess. An operand that has operators on both sides is operand of the operator of higher precedence. For instance, in 3 * 4 + 6 4 is operand of * but not of +. Indeed, the operands of + are 3*4 and 6. do you happen to know some site that shows the relevant page i can have a look? Nope, sorry. Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?
Rick Johnson rantingrickjohn...@gmail.com wrote: Book authors and Doc authors are not always the most well informed; as we have witnessed by this very thread! Obviously these tutorials are more like: What NOT to do when coding Tkinter GUIs! No wonder everyone hates Tkinter. :-) Indeed. One of the things that motivated me to write the tutorial at http://www.tkdocs.com is the rather poor state (in terms of being out of date, incorrect, or demonstrating poor practices) of most Tkinter documentation. Call it self-serving, but I think the Tkinter world would be a happier place if everyone just pointed to TkDocs. ;-) To your point about explicit root, etc. I'll make the general observation that lots of different things work in a given situation, which is just fine for quick little hacky things. If people are doing anything more than a throwaway however, they'd be better served by spending a bit of time learning the conceptual underpinnings (e.g. http://www.tkdocs.com/tutorial/concepts.html) after which the right thing to do will be more obvious. Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
In OD44r.17949$vo2.12...@newsfe07.iad, on 03/02/2012 at 02:17 PM, Chiron chiron...@gmail.com said: What always gets me is how so many people criticized Sokal for doing it, Google for Omerta. It's common for whistle blowers to be chastised or even persecuted. I agree that the criticism of Prof Sokal was outrageous, but it was also predictable. -- Shmuel (Seymour J.) Metz, SysProg and JOAT http://patriot.net/~shmuel Unsolicited bulk E-mail subject to legal action. I reserve the right to publicly post or ridicule any abusive E-mail. Reply to domain Patriot dot net user shmuel+news to contact me. Do not reply to spamt...@library.lspace.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this the proper way to use a class method?
Oh, but it does get passed, just implicitly. `super()` basically grabs `self` magically from its caller, and uses it to bind method calls on the magical object returned by `super()`. Thanks again, now I understand :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?
Indeed. One of the things that motivated me to write the tutorial at http://www.tkdocs.com is the rather poor state (in terms of being out of date, incorrect, or demonstrating poor practices) of most Tkinter documentation. Call it self-serving, but I think the Tkinter world would be a happier place if everyone just pointed to TkDocs. ;-) To your point about explicit root, etc. I'll make the general observation that lots of different things work in a given situation, which is just fine for quick little hacky things. If people are doing anything more than a throwaway however, they'd be better served by spending a bit of time learning the conceptual underpinnings (e.g. http://www.tkdocs.com/tutorial/concepts.html) after which the right thing to do will be more obvious. Mark Nice. I shall be spending some time at your website. I actually like wxPython, but I decided to learn a little Tkinter because it's already included and would be an easier and quicker option for small interfaces. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
On Fri, 02 Mar 2012 10:53:30 -0500, Shmuel (Seymour J.) Metz wrote: In OD44r.17949$vo2.12...@newsfe07.iad, on 03/02/2012 at 02:17 PM, Chiron chiron...@gmail.com said: What always gets me is how so many people criticized Sokal for doing it, Google for Omerta. It's common for whistle blowers to be chastised or even persecuted. I agree that the criticism of Prof Sokal was outrageous, but it was also predictable. Yeah, omerta... I'm familiar with it. Talk and you're dead, and they put a canary in your mouth (well, some folks do, anyway). But of course you're right - it's a milder form of omerta. It's just so misguided. Kill the messenger. Imprison the whistle-blower. -- Imitation is the sincerest form of plagiarism. -- http://mail.python.org/mailman/listinfo/python-list
decompilation
Hi Please decoplile the .pyc code ,as i have lost my .py code. Thanks, Shikha hangman322.pyc Description: Binary data -- http://mail.python.org/mailman/listinfo/python-list
Python - CGI-BIN - Apache Timeout Problem
Hello List, Would appreciate some insight/help, ran out of ideas... BRIEF OVERVIEW: I am trying to create a simple webserver gui wrapper for a set of scripts I developed to test some of our firewalls here at Cisco. Being that the total amount of engineer that will ever probably use this is 4 people and my limited python experience I just decided to do a quick cgi-bin solution. I control the machine with the webserver on em0 where I do my fw testing on em1/em2. Browser goes to http://webserver/main.py- main.py executes a script-tests.py -test.py imports my engine v6tester_main.py which is a series of functions I wrote. tests.py kicks of whatever test main.py wanted. THE PROBLEM: When I execute the scripts from the command line (#python main.py) it generates it fine (albeit slowly), it prints all the html code out including the script. The 'core' part of the script dumbed down to the lowest level is- proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], stdout=subprocess.PIPE) output = proc.stdout.read() print output proc.stdout.close() When I open main.py and execute the script it just hangs... it seems to execute the script (I see pcap fires on the interface that I am testing on the firewall) but its not executing correctly... or loading the entire webpage...the webpage keeps chugging along and eventually gives me an error timeout. I know it's not a permissions issue or setup issue b/c I did a proof of concept where I just fired one simple pcap and it works fine (reported back just like it would if I ran it on the command line).. it has something to do with either the amount of prints out the script is doing, or the timing. I see no problems except the timeout (nothing in logs: /var/log/http-error.log). My script takes about 8 secounds to run. It does use threading but I wouldn't think that would mess it up. BTW: I posted here if this helps anyone: http://stackoverflow.com/questions/9524758/cgi-bin-timing-timeout-on-fre ebsd-apache22 Thanks in advance for any ideas. I can include the whole main.py if that would help. Sean Cavanaugh Cisco Systems -- http://mail.python.org/mailman/listinfo/python-list
Re: decompilation
On Fri, Mar 2, 2012 at 10:52 AM, shikha panghal spdollyshik...@gmail.com wrote: Hi Please decoplile the .pyc code ,as i have lost my .py code. Your best shot would be: http://www.crazy-compilers.com/decompyle/ Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: decompilation
On 2 March 2012 18:52, shikha panghal spdollyshik...@gmail.com wrote: Hi Please decoplile the .pyc code ,as i have lost my .py code. Aha, a customer! I've written a module for this: unpyc3 (http://code.google.com/p/unpyc3/) Here it is in action: Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul 9 2011, 01:03:53) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. import unpyc3 import hangman322 code = unpyc3.decompile(hangman322) print(code) import random def readFile(fileName): file = open(fileName) lineList = file.readlines() file.close() return lineList def initialize(fileName): try: lineList = readFile(fileName) except: print('Oops! ' + filename + ' was not a valid file.') return len_d = len(lineList) word_length = [0]*len_d for i in range(len_d): if lineList[i][-1] == '\n': word_length[i] = len(lineList[i]) - 1 else: word_length[i] = len(lineList[i]) tabulate = [0]*25 for i in range(len_d): if word_length[i] = 24: tabulate[24] = tabulate[24] + 1 else: tabulate[word_length[i]] = tabulate[word_length[i]] + 1 words = [None]*25 for i in range(2, 24): words[i] = [None]*tabulate[i] k = 0 for j in range(len_d): if word_length[j] == i: words[i][k] = lineList[j] k = k + 1 for i in range(24, 25): words[i] = [None]*tabulate[i] k = 0 for j in range(len_d): if word_length[j] = i: words[i][k] = lineList[j] k = k + 1 return words def wordsOfLength(n, source_file): words = initialize(source_file) return words[n] def getUserStringInput(L, prompt): replyInList = False while not replyInList: reply = input(prompt) replyInList = reply in L if not replyInList: print('That reply is invalid. Try again.') return reply def intListToStringList(L): L2 = ['']*len(L) for i in range(len(L)): L2[i] = str(L[i]) return L2 def getNewLetterGuess(availableLetters): letterString = '' for j in range(26): if availableLetters[j]: letterString = letterString + chr(65 + j) + ' ' else: letterString = letterString + ' ' validChar = False print(letterString) while not validChar: reply = input('Guess! ') if len(reply) == 1: validChar = True letterIndex = ord(reply) - 65 if letterIndex 25: letterIndex = letterIndex - 32 while letterIndex 25 or not availableLetters[letterIndex]: print('This is an invalid choice. Please try again!') validChar = False print(letterString) while not validChar: reply = input('Guess! ') if len(reply) == 1: validChar = True letterIndex = ord(reply) - 65 if letterIndex 25: letterIndex = letterIndex - 32 guess = chr(97 + letterIndex) availableLetters[letterIndex] = False return guess, availableLetters def getWordFamilyCounter(L, n, guess): wordFamilyCounter = [0]*2**n familyIndexList = [-1]*len(L) for k in range(len(L)): w = list(L[k]) ct = 0 for k2 in range(n): if w[k2] == guess: ct = ct + 2**k2 familyIndexList[k] = ct wordFamilyCounter[ct] = wordFamilyCounter[ct] + 1 return wordFamilyCounter, familyIndexList def extractLargestFamily(L, familyIndexList, wordFamilyCounter): bestFamily = wordFamilyCounter.index(max(wordFamilyCounter)) boolist = [False]*len(L) for k3 in range(len(L)): if familyIndexList[k3] == bestFamily: boolist[k3] = True j2 = 0 smallList = [' ']*sum(boolist) for k4 in range(len(L)): if boolist[k4]: smallList[j2] = L[k4] j2 = j2 + 1 return smallList def updatePatternList(patternList, guess, bestFamily): n = len(patternList) for k6 in range(n): if bestFamily//2 == bestFamily/2: pass else: patternList[k6] = guess + ' ' bestFamily = bestFamily 1 return patternList def pickWordFrom(L): index = random.randint(0, len(L) - 1) return L[index] def play(): reply = getUserStringInput(intListToStringList(list(range(2, 21))), 'How long should I make your word?!!? (2 to 20) ') n = int(reply) patternList = ['_ ']*n print(''.join(patternList)) L = wordsOfLength(n, 'dictionary.txt') reply = getUserStringInput(intListToStringList(list(range(1, 27))), 'How many guesses will you need? ') m = int(reply) availableLetters = [True]*26 for i in range(m): guess, availableLetters = getNewLetterGuess(availableLetters) wordFamilyCounter, familyIndexList = getWordFamilyCounter(L, n,
Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?
On 3/1/2012 10:43 PM, Terry Reedy wrote: Not sure what is happening on your end, but i don't see any braces. Are you saying that if you change Hello_World\n(click_me) to Hello World\n(click me), you see Hello World (click me) as I expected, instead of {Hellow World (click me)} as I do see? What OS are you running? And what tk version? (I have 8.5.9 in Win7) The problem was another subtle bug in the current example: self.hi_there[text] = Hello, The spurious comma at the end makes the value of the 'text' attribute a one-elememt tuple and not just a string. I presume tcl-based tk handles that in the manner appropriate for the tcl equivalent. I believe tcl uses spaces rather than commas to separate items, so the braces serve as 'quotes' to indicate that the contents are one item, not three. Removing the comma solves the problem. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Python - CGI-BIN - Apache Timeout Problem
On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau) scava...@cisco.com wrote: snip THE PROBLEM: When I execute the scripts from the command line (#python main.py) it generates it fine (albeit slowly), it prints all the html code out including the script. The ‘core’ part of the script dumbed down to the lowest level is- proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], stdout=subprocess.PIPE) output = proc.stdout.read() Note the red warning box about possible deadlock with .stdout.read() and friends: http://docs.python.org/library/subprocess.html#popen-objects print output proc.stdout.close() As the docs advise, try using .communicate() [http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate ] instead: proc = subprocess.Popen(…) out, err = proc.communicate() print out When I open main.py and execute the script it just hangs… it seems to execute the script (I see pcap fires on the interface that I am testing on the firewall) but its not executing correctly… or loading the entire webpage…the webpage keeps chugging along and eventually gives me an error timeout. The hanging makes me suspect that the aforementioned deadlock is occurring. Cheers, Chris -- http://chrisrebert.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?
Terry Reedy wrote: The problem was another subtle bug in the current example: self.hi_there[text] = Hello, The spurious comma at the end makes the value of the 'text' attribute a one-elememt tuple and not just a string. I presume tcl-based tk handles that in the manner appropriate for the tcl equivalent. I believe tcl uses spaces rather than commas to separate items, so the braces serve as 'quotes' to indicate that the contents are one item, not three. Removing the comma solves the problem. That looks like it. Tcl is the 'LISP of strings' Composite-object things like indexing work on space-separated strings. Mel. -- http://mail.python.org/mailman/listinfo/python-list
RE: Python - CGI-BIN - Apache Timeout Problem
Hey Chris, Thanks for your quick reply! I switched my code to- proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], stdout=subprocess.PIPE) out, err = proc.communicate() print out proc.stdout.close() It still dead locked. Interestingly enough When I did a #python tests.py on the command line even that was taking awhile to print out to the command line so I decided to restart my webserver... wow from mucking before something must have been running in the background still. I got the script down to 2 seconds or so... Now it still works but faster when I do #python main.py it generates all the text to the command line but the website still hangs when I go to http://webserver/main.py... I am not sure what is going wrong... no error in the /var/log except for the eventual timeout after a couple minutes goes by. -S -Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Friday, March 02, 2012 3:23 PM To: Sean Cavanaugh (scavanau) Cc: python-list@python.org Subject: Re: Python - CGI-BIN - Apache Timeout Problem On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau) scava...@cisco.com wrote: snip THE PROBLEM: When I execute the scripts from the command line (#python main.py) it generates it fine (albeit slowly), it prints all the html code out including the script. The ‘core’ part of the script dumbed down to the lowest level is- proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], stdout=subprocess.PIPE) output = proc.stdout.read() Note the red warning box about possible deadlock with .stdout.read() and friends: http://docs.python.org/library/subprocess.html#popen-objects print output proc.stdout.close() As the docs advise, try using .communicate() [http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate ] instead: proc = subprocess.Popen(…) out, err = proc.communicate() print out When I open main.py and execute the script it just hangs… it seems to execute the script (I see pcap fires on the interface that I am testing on the firewall) but its not executing correctly… or loading the entire webpage…the webpage keeps chugging along and eventually gives me an error timeout. The hanging makes me suspect that the aforementioned deadlock is occurring. Cheers, Chris -- http://chrisrebert.com -- http://mail.python.org/mailman/listinfo/python-list
RE: Python - CGI-BIN - Apache Timeout Problem
Hey All, So maybe this part is important (after doing some troubleshooting) hopefully not everyone has beers in hand already since its Friday :-) The way the code works if you want to send through the firewall (i.e. SERVER-FIREWALL-SERVER) I split the process into two threads. One is listening on the egress, then I send on the ingress. The main waits until the thread finishes (it times out after 2 seconds). I had to do this b/c scapy (the library I used) won't let me send pcaps while I receive them. This lets me see packets on both sides (i.e. did that sort of internet traffic go through the firewall). The reason I think this could be a problem is when I ran a test where I sent to the firewall (rather than through it) and my program does not need to thread the webserver works fine.. Suggestions anyone? -S -Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Friday, March 02, 2012 3:23 PM To: Sean Cavanaugh (scavanau) Cc: python-list@python.org Subject: Re: Python - CGI-BIN - Apache Timeout Problem On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau) scava...@cisco.com wrote: snip THE PROBLEM: When I execute the scripts from the command line (#python main.py) it generates it fine (albeit slowly), it prints all the html code out including the script. The ‘core’ part of the script dumbed down to the lowest level is- proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], stdout=subprocess.PIPE) output = proc.stdout.read() Note the red warning box about possible deadlock with .stdout.read() and friends: http://docs.python.org/library/subprocess.html#popen-objects print output proc.stdout.close() As the docs advise, try using .communicate() [http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate ] instead: proc = subprocess.Popen(…) out, err = proc.communicate() print out When I open main.py and execute the script it just hangs… it seems to execute the script (I see pcap fires on the interface that I am testing on the firewall) but its not executing correctly… or loading the entire webpage…the webpage keeps chugging along and eventually gives me an error timeout. The hanging makes me suspect that the aforementioned deadlock is occurring. Cheers, Chris -- http://chrisrebert.com -- http://mail.python.org/mailman/listinfo/python-list
Re: decompilation
Le 02/03/2012 21:18, Arnaud Delobelle a écrit : On 2 March 2012 18:52, shikha panghalspdollyshik...@gmail.com wrote: Hi Please decoplile the .pyc code ,as i have lost my .py code. Aha, a customer! I've written a module for this: unpyc3 (http://code.google.com/p/unpyc3/) Here it is in action: Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul 9 2011, 01:03:53) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. import unpyc3 import hangman322 code = unpyc3.decompile(hangman322) print(code) import random def readFile(fileName): file = open(fileName) lineList = file.readlines() file.close() return lineList def initialize(fileName): try: lineList = readFile(fileName) except: print('Oops! ' + filename + ' was not a valid file.') return len_d = len(lineList) word_length = [0]*len_d for i in range(len_d): if lineList[i][-1] == '\n': word_length[i] = len(lineList[i]) - 1 else: word_length[i] = len(lineList[i]) tabulate = [0]*25 for i in range(len_d): if word_length[i]= 24: tabulate[24] = tabulate[24] + 1 else: tabulate[word_length[i]] = tabulate[word_length[i]] + 1 words = [None]*25 for i in range(2, 24): words[i] = [None]*tabulate[i] k = 0 for j in range(len_d): if word_length[j] == i: words[i][k] = lineList[j] k = k + 1 for i in range(24, 25): words[i] = [None]*tabulate[i] k = 0 for j in range(len_d): if word_length[j]= i: words[i][k] = lineList[j] k = k + 1 return words def wordsOfLength(n, source_file): words = initialize(source_file) return words[n] def getUserStringInput(L, prompt): replyInList = False while not replyInList: reply = input(prompt) replyInList = reply in L if not replyInList: print('That reply is invalid. Try again.') return reply def intListToStringList(L): L2 = ['']*len(L) for i in range(len(L)): L2[i] = str(L[i]) return L2 def getNewLetterGuess(availableLetters): letterString = '' for j in range(26): if availableLetters[j]: letterString = letterString + chr(65 + j) + ' ' else: letterString = letterString + ' ' validChar = False print(letterString) while not validChar: reply = input('Guess! ') if len(reply) == 1: validChar = True letterIndex = ord(reply) - 65 if letterIndex 25: letterIndex = letterIndex - 32 while letterIndex 25 or not availableLetters[letterIndex]: print('This is an invalid choice. Please try again!') validChar = False print(letterString) while not validChar: reply = input('Guess! ') if len(reply) == 1: validChar = True letterIndex = ord(reply) - 65 if letterIndex 25: letterIndex = letterIndex - 32 guess = chr(97 + letterIndex) availableLetters[letterIndex] = False return guess, availableLetters def getWordFamilyCounter(L, n, guess): wordFamilyCounter = [0]*2**n familyIndexList = [-1]*len(L) for k in range(len(L)): w = list(L[k]) ct = 0 for k2 in range(n): if w[k2] == guess: ct = ct + 2**k2 familyIndexList[k] = ct wordFamilyCounter[ct] = wordFamilyCounter[ct] + 1 return wordFamilyCounter, familyIndexList def extractLargestFamily(L, familyIndexList, wordFamilyCounter): bestFamily = wordFamilyCounter.index(max(wordFamilyCounter)) boolist = [False]*len(L) for k3 in range(len(L)): if familyIndexList[k3] == bestFamily: boolist[k3] = True j2 = 0 smallList = [' ']*sum(boolist) for k4 in range(len(L)): if boolist[k4]: smallList[j2] = L[k4] j2 = j2 + 1 return smallList def updatePatternList(patternList, guess, bestFamily): n = len(patternList) for k6 in range(n): if bestFamily//2 == bestFamily/2: pass else: patternList[k6] = guess + ' ' bestFamily = bestFamily 1 return patternList def pickWordFrom(L): index = random.randint(0, len(L) - 1) return L[index] def play(): reply = getUserStringInput(intListToStringList(list(range(2, 21))), 'How long should I make your word?!!? (2 to 20) ') n = int(reply) patternList = ['_ ']*n print(''.join(patternList)) L = wordsOfLength(n, 'dictionary.txt') reply = getUserStringInput(intListToStringList(list(range(1, 27))), 'How many guesses will you need? ') m = int(reply) availableLetters = [True]*26
Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?
After that, you can nest as many frames, toplevels, and blah widgets under that root window as you so desire. Actually you don't even need a frame, you can pack widgets directly into a Toplevel or Tk widget. This is interesting. I completely understand your point about always calling (and using) the instance of Tk as the root. Given that, what is the point of creating a Frame object at all? I tried NOT doing it, like you said, and it seemed to work fine with my simple example. But is there a benefit to using a Frame object to group the widgets together? Or is it cleaner to just use the Tk object? -- http://mail.python.org/mailman/listinfo/python-list
A possible change to decimal.Decimal?
HISTORY: In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I discovered a problem in using decimal.Decimal. A short search revealed that many other people have been having the problem as well, in their own apache/wsgi implementations (django, mostly), but I found no real solutions among the posts I read. So I did some experimentation of my own. The following code will break unexpectedly on standard python2.7 (and earlier) because of the way that isinstance fails after reload() (which is called by both of the above web frameworks). This is the error: TypeError(Cannot convert %r to Decimal % value) THE TEST CODE import decimal from decimal import Decimal #this works Decimal(Decimal()) reload(decimal) #this fails before patching, but works fine afterwards Decimal(Decimal()) THE SOLUTION: So, looking into decimal.py I discovered lots if statements using isinstance, and have slightly rearranged the code inside __new__() to mostly remove their use, and for my purposes totally fixes the problem within wsgi. I am not an official python dev, so would appreciate it if someone who *IS* could just look this over, improve it if necessary, and get it (or some variation) submitted into the library. Below is a patch for use against python-2.7.2 PATCH: *** decimal.py 2012-03-02 16:42:51.285964007 -0600 --- /usr/lib/python2.7/decimal.py 2012-03-02 14:36:01.238976461 -0600 *** *** 535,608 # and the Decimal constructor still deal with tuples of # digits. self = object.__new__(cls) ! # From a string ! # REs insist on real strings, so we can too. ! if isinstance(value, basestring): ! m = _parser(value.strip()) ! if m is None: ! if context is None: ! context = getcontext() ! return context._raise_error(ConversionSyntax, ! Invalid literal for Decimal: %r % value) ! ! if m.group('sign') == -: ! self._sign = 1 ! else: ! self._sign = 0 ! intpart = m.group('int') ! if intpart is not None: ! # finite number ! fracpart = m.group('frac') or '' ! exp = int(m.group('exp') or '0') ! self._int = str(int(intpart+fracpart)) ! self._exp = exp - len(fracpart) ! self._is_special = False ! else: ! diag = m.group('diag') ! if diag is not None: ! # NaN ! self._int = str(int(diag or '0')).lstrip('0') ! if m.group('signal'): ! self._exp = 'N' ! else: ! self._exp = 'n' ! else: ! # infinity ! self._int = '0' ! self._exp = 'F' ! self._is_special = True ! return self ! ! # From an integer ! if isinstance(value, (int,long)): ! if value = 0: ! self._sign = 0 ! else: ! self._sign = 1 ! self._exp = 0 ! self._int = str(abs(value)) ! self._is_special = False return self ! # From another decimal ! if isinstance(value, Decimal): self._exp = value._exp self._sign = value._sign self._int = value._int self._is_special = value._is_special return self # From an internal working value ! if isinstance(value, _WorkRep): self._sign = value.sign self._int = str(value.int) self._exp = int(value.exp) self._is_special = False return self # tuple/list conversion (possibly from as_tuple()) if isinstance(value, (list,tuple)): if len(value) != 3: raise ValueError('Invalid tuple size in creation of Decimal ' --- 535,582 # and the Decimal constructor still deal with tuples of # digits. self = object.__new__(cls) ! # Note about isinstance -- Decimal has been a victim of the ! # isinstance builtin failing after module reload in some ! # environments (e.g. web.py, django) under apache/wsgi, which ! # I determined to be the reason Decimal was causing so many ! # problems in my web deployment. I have re-organized the ! # following code to remove use of isinstance except on ! # native types (int, long, float, list, tuple), since those ! # seem not to break in this regard. -- jdb ! ! # First, assume it's another Decimal or similar(having _exp, ! # _sign, _int and _is_special. Obviously, having these ! #
Re: A possible change to decimal.Decimal?
The problem with that though is: I am not the one calling reload(). That is actually being called for me by web.py (or django, or some other framework, take your pick). More than that, I believe it's called (or caused, anyway) by something happening in WSGI under apache. (And I don't really want to start digging around in there either) The patch in this case is very limited in scope, and all it inflicts on the subject code inside of decimal.Decimal.__new__(), is better programming practices. --jeff On Fri, Mar 2, 2012 at 5:49 PM, Ethan Furman et...@stoneleaf.us wrote: Jeff Beardsley wrote: HISTORY: In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I discovered a problem in using decimal.Decimal. A short search revealed that many other people have been having the problem as well, in their own apache/wsgi implementations (django, mostly), but I found no real solutions among the posts I read. So I did some experimentation of my own. The following code will break unexpectedly on standard python2.7 (and earlier) because of the way that isinstance fails after reload() (which is called by both of the above web frameworks). This is the error: TypeError(Cannot convert %r to Decimal % value) THE TEST CODE import decimal from decimal import Decimal #this works Decimal(Decimal()) reload(decimal) #this fails before patching, but works fine afterwards Decimal(Decimal()) Patching decimal.py to make it work with reload() is probably not going to happen. What you should be doing is: import decimal from decimal import Decimal reload(decimal) Decimal = decimal.Decimal # (rebind 'Decimal' to the reloaded code) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: A possible change to decimal.Decimal?
Jeff Beardsley wrote: HISTORY: In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I discovered a problem in using decimal.Decimal. A short search revealed that many other people have been having the problem as well, in their own apache/wsgi implementations (django, mostly), but I found no real solutions among the posts I read. So I did some experimentation of my own. The following code will break unexpectedly on standard python2.7 (and earlier) because of the way that isinstance fails after reload() (which is called by both of the above web frameworks). This is the error: TypeError(Cannot convert %r to Decimal % value) THE TEST CODE import decimal from decimal import Decimal #this works Decimal(Decimal()) reload(decimal) #this fails before patching, but works fine afterwards Decimal(Decimal()) Patching decimal.py to make it work with reload() is probably not going to happen. What you should be doing is: import decimal from decimal import Decimal reload(decimal) Decimal = decimal.Decimal # (rebind 'Decimal' to the reloaded code) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
How do you use the widgets in tkinter.ttk if you want to import tkinter as tk?
According to the Python docs, the way to use tkinter.ttk is this: from tkinter import * from tkinter.ttk import * But what if I don't like this import method and prefer to do: import tkinter as tk How then do I utilize tkinter.ttk using the same name? Or is that not possible? Will I have to use to separate names, like this: import tkinter as tk import tkinter.ttk as ttk Is that the only way? -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you use the widgets in tkinter.ttk if you want to import tkinter as tk?
On 3/2/2012 8:48 PM, John Salerno wrote: According to the Python docs, the way to use tkinter.ttk is this: from tkinter import * from tkinter.ttk import * I suppose the 'advantage' of this is that it will replace tk widgets with equivalent ttk widgets, if they exist and have the same name. I believe one has to program them differently, however, so the replacement cannot be transparent and one mush know anyway what gets replaced and what not. But what if I don't like this import method and prefer to do: import tkinter as tk How then do I utilize tkinter.ttk using the same name? Or is that not possible? Will I have to use to separate names, like this: No. One name for one object. import tkinter as tk import tkinter.ttk as ttk Yes -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Unable to install xmldiff package on WIndows7
On Jan 3, 11:47 am, hisan santosh.s...@gmail.com wrote: Hi All i have downloaded xmldiff-0.6.10 from their official site (http://www.logilab.org/859). I have tried installing the same on my 32 bit Windows 7 OS using the command setup.py install but below exceptions are thrown in the console. please help me out in installing this package on Windows Exceptions thrown while installing C:\Users\santosh\Downloads\xmldiff-0.6.10setup.py build running build running build_py package init file '.\test\__init__.py' not found (or not a regular file) package init file '.\test\__init__.py' not found (or not a regular file) running build_ext building 'xmldiff.maplookup' extension gcc -mno-cygwin -mdll -O -Wall -ID:\Python26\include -ID:\Python26\PC - c extensions/maplookup.c -o b uild\temp.win32-2.6\Release\extensions\maplookup.o error: command 'gcc' failed: No such file or directory edit maplookup.c and comment away the line : #include inttypes.h. At least that's what worked for me. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you use the widgets in tkinter.ttk if you want to import tkinter as tk?
Terry Reedy tjre...@udel.edu writes: On 3/2/2012 8:48 PM, John Salerno wrote: from tkinter import * from tkinter.ttk import * I suppose the 'advantage' of this is that it will replace tk widgets with equivalent ttk widgets, if they exist and have the same name. I believe one has to program them differently, however, so the replacement cannot be transparent and one mush know anyway what gets replaced and what not. Yes, and one mush is exactly what one gets when clobbering the namespace with ‘from foo import *’ :-) -- \ “We are human only to the extent that our ideas remain humane.” | `\ —_Breakfast of Champions_, Kurt Vonnegut | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Udacity CS 101
On Monday, February 27, 2012 6:37:25 PM UTC-8, Ray Clark wrote: You have to remember that this course assumes no prior computer programming knowledge. I agree, it is starting out very basic. Give it some more time. These guys have PhDs from MIT and/or have taught at Stanford. They know what they are doing. It seems to me that they're not starting with good Python practices, really, or even the terminology I'd expect. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you use the widgets in tkinter.ttk if you want to import tkinter as tk?
I suppose the 'advantage' of this is that it will replace tk widgets with equivalent ttk widgets, if they exist and have the same name. I believe one has to program them differently, however, so the replacement cannot be transparent and one mush know anyway what gets replaced and what not. Grr, sounds like a pain if I want to use the new widgets. Does this cause conflict with someone who isn't running 8.5, or will they still see the older widgets as normal? I'm tempted just to go back to wxPython. Two sets of widgets in Tkinter is a little annoying. -- http://mail.python.org/mailman/listinfo/python-list
Re: A 'Python like' language
On Tuesday, March 30, 2004 12:31:35 AM UTC-7, Mark Hahn wrote: --Take advantage of iterators early on for return values to avoid things like having both dict.items() and dict.iteritems(). Interestiong idea. Generators are fully supported so I could do this now. So gens would have to be allowed absolutely everywhere lists are allowed (is trhis possible?). Or are you thinking the user should type List(dict.items()) ? No, the former. Most of the time you never really use a full, naked list anyway, generally only for documentation purposes. --Choose {:} syntax for empty dict creation to reserve {} for sets. (Or: use {} for both, and do automatic set-to-dict Also cool. Maybe for sets? Prothon doesn't support as != so it is free. I strongly suggest the standard (in math anyway) syntax for set notation. It shouldn't be hard to parse whether code syntax is referring to a set vs. dict. --Functions that return multiple, but unique, values should return a set, not a list, to communicate same (ex: dict.keys(), dir(), etc.). Also cool. This is something that still hasn't really been implemented in PythonV3. --Dict should inherit from Set. Also cool (I feel like the credits of Holy Grail saying Also wik). An alternative is to create a named association type, similar to the ABC programming language, denoted by the colon. name: []. A dict then would simply be a set of these. Having a compound type would come in handy in several other ways too. --With prothon's immutability bit and other considerations, does the language need both tuples AND lists? I like this a lot. Tuples are already implemented internally as lists. I think, in fact, that the object model could be more unified. Under such a new object model, the worries about having a full library becomes rather pointless, as the new model will require a revamping of everything. More like a few dollars. This is really good stuff. Can I talk you into hanging out on the Prothon list now and then, at least until we get the core language sorted out? Haha, a little late, but consider this a restart. -- http://mail.python.org/mailman/listinfo/python-list
Re: A 'Python like' language
dreamingforw...@gmail.com writes: hanging out on the Prothon list now and then, at least until we get the core language sorted out? Haha, a little late, but consider this a restart. It wasn't til I saw the word Prothon that I scrolled back and saw you were responding to a thread from 2004. Prothon was pretty cool in some ways but I think it's been inactive for a very long time. I don't see much point to developing a slightly improved but incompatible Python-like language anyway though. Why make superficial changes that break working code and mentally overload programmers? Python is a relatively mature language by now, so it shouldn't be messed with unless the changes produce drastic benefits, not minor ones. -- http://mail.python.org/mailman/listinfo/python-list
Re: A 'Python like' language
On Tuesday, March 30, 2004 6:01:01 AM UTC-7, Gerrit wrote: --Dict should inherit from Set. Also cool (I feel like the credits of Holy Grail saying Also wik). I have read (in c.l.py) that in Smalltalk, a Dict is a Set of Associates or something similar. I don't know Smalltalk, but I like this idea of a Set. Yeah, I like this too. I take it from the ABC language. The thing that's relevant (and apropos to Paul Rubin's objection), is that when unifying models, you have to decide where the decimal point is from which all the different dimensions that the language is encoding and silently tracking can pivot around. The : of a compound is a sort of decimal point. Then the task is finding a formalism in which to define and incorporate all the relavent dimensions into one. The result will be necessarily recursive, revolving around the notions of the atomic versus the group and the transition rules that govern them. mark (aka zipher) -- http://mail.python.org/mailman/listinfo/python-list
[issue8706] accept keyword arguments on most base type methods and builtins
Éric Araujo mer...@netwok.org added the comment: See also #13386 for the doc part. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8706 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8754] quote bad module name in ImportError-like messages
Éric Araujo mer...@netwok.org added the comment: With issue1559549 adding a 'name' argument, I'm going to push to have it gain a reasonable default __str__ if 'name' is set but nothing else. That patch also contains some helper functions which should simplify Eric's patch. Maybe you’re talking about my first patch? The latest one does not touch C code and I don’t see why it depends on the other bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14168] minidom behaves differently in 3.3 compared to 3.2
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: The error which prompted this issue was not caused by external code peeking into the internals - it was just my toy test script which did that. The error came up in Django testing: == ERROR: test_secure_urls (regressiontests.syndication.tests.SyndicationFeedTest) -- Traceback (most recent call last): File /Users/vinay/projects/django3/tests/regressiontests/syndication/tests.py, line 255, in test_secure_urls if link.getAttribute('rel') == 'self': File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/xml/dom/minidom.py, line 727, in getAttribute return self._attrs[attname].value TypeError: 'NoneType' object is not subscriptable So, perhaps there is a missing _ensure_attributes() call somewhere. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14168] minidom behaves differently in 3.3 compared to 3.2
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Upon inspection, _ensure_attributes() is only called in _get_attributes(), setAttributeNode() and _set_attribute_node(). The last of these is only called by setAttributeNode(), and it would appear that setAttributeNode() is only called if there *are* attributes. _get_attributes() is only called by writexml(). So, calls to public methods getAttribute(), getAttributeNS() and a few others are likely to fail because, if there are no attributes in the XML being processed, _ensure_attributes() wouldn't get called. It looks like a bug to me! ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14168] Bug in minidom 3.3 after optimization patch
Éric Araujo mer...@netwok.org added the comment: Agreed :) Needs unit tests that use the public attributes. -- keywords: +easy -3.2regression stage: - needs patch title: minidom behaves differently in 3.3 compared to 3.2 - Bug in minidom 3.3 after optimization patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14168 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14158] test_mailbox fails if file or dir named by support.TESTFN exists
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Is 2.7 not affected? It might be, but the code for regrtest looked somewhat different. I will revisit this once the buildbots have run for a few days with the 3.x changes, to confirm that they are OK. Marking as pending to remind me. -- status: closed - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14158 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14172] ref-counting leak in buffer usage in Python/marshal.c
New submission from Stefan Behnel sco...@users.sourceforge.net: Line 428 in Python/marshal.c calls pb-bf_releasebuffer() without dec-refing the view.obj field afterwards. I don't think this is really so truly performance critical that it can't accept the couple of nanoseconds that it takes to go through PyBuffer_Release() instead. -- components: Interpreter Core messages: 154755 nosy: scoder priority: normal severity: normal status: open title: ref-counting leak in buffer usage in Python/marshal.c type: behavior versions: Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14170] print unicode string error in win8 cmd console
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Stefan Behnel sco...@users.sourceforge.net added the comment: Thanks Eli. What about the Lightweight DOM implementation, though? Following Martin's comment that performance characteristics (like fast, memory friendly or lightweight) should normally not be documented, I'm still suggesting to replace it with a less easily misinterpreted phrase like W3C DOM implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14128] _elementtree should expose types and factory functions consistently with ElementTree
Eli Bendersky eli...@gmail.com added the comment: Attaching a patch that exposes ET.Element as a type, instead of as a factory function. I'd really love to get a review for this, since I'm still relatively inexperienced when it comes to writing C extension code. -- keywords: +patch Added file: http://bugs.python.org/file24702/Element_class_issue14128.1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14128 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13462] Improve code and tests for Mixin2to3
Changes by Eli Bendersky eli...@gmail.com: -- priority: - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14173] PyOS_FiniInterupts leaves signal.getsignal segfaulty
New submission from Ferringb ferri...@gmail.com: During Py_Finalize (pythonrun.c), it does the following: 1) suppress signal handling PyOs_FiniInterupts 2) clear caches 3) force gc collection; first for objects, then via wiping modules. The problem is that for unix OSs, Modules/signal.c's PyOs_FiniInterrupts leaves itself in a state where its internal Handlers are effectively reset to NULL, except the various functions don't properly handle that scenario. Attached is a test case demonstrating it; it segfaults on every python version I've tested (2.4-3.2; haven't tried 3.3). Since this *only* occurs during the final gc sweep when modules are destroyed, its a bit of a pain in the ass to detect that we're in that scenario, and that we must not touch signal.getsignal lest it segfault the interp. That said, def _SignalModuleUsable(): try: signal.signal(signal.SIGUSR1, signal.signal(signal.SIGUSR1, some_handler)) return True except (TypeError, AttributeError, SystemError): # we were invoked in a module cleanup context. return False does manage to poke the api just right so that it can be detected w/out segfaulting the interp. Finally, note that while folks could point at __del__... its not really at fault. Doing a proper weakref.ref finalizer can trigger the same- the fault is signal.c's PyOs_FiniInterrupts leaving the signal module in a bad state. For the testcase, I used __del__ just because it was quicker/less code to do so. -- components: Interpreter Core files: test.py messages: 154758 nosy: ferringb priority: normal severity: normal status: open title: PyOS_FiniInterupts leaves signal.getsignal segfaulty type: crash versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 Added file: http://bugs.python.org/file24703/test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14173 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Eli Bendersky eli...@gmail.com added the comment: Stefan, frankly I'm not familiar enough with either xml.dom or xml.dom.minidom to have a solid opinion at this point. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Éric Araujo mer...@netwok.org added the comment: I think I’ve always understood “lightweight” to mean “minimal”. xml.dom provides minidom, a basic implementation, pulldom, a different implementation, and other libraries such as 4Dom are full-fledged implementations. So “lightweight” is not a problem to me (but I acknowledge that it might be misleading for other people), especially given that I think that DOM itself is not elegant or lightweight (as in “conceptually small”). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
New submission from Arnout van Meer rr2...@gmail.com: Reproduction case is attached and should speak for itself, but the short brief is that the argparse.REMAINDER behaviour is very inconsistent based on what (potentially) defined argument handlers come before it. Tested this on Python 2.7 on OS X, but also grabbed the latest argparse.py from hg to verify against this. -- components: Library (Lib) files: worker.py messages: 154761 nosy: rr2do2 priority: normal severity: normal status: open title: argparse.REMAINDER fails to parse remainder correctly type: behavior versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Removed file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Added file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Added file: http://bugs.python.org/file24705/bug_argparse.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Removed file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Removed file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14174] argparse.REMAINDER fails to parse remainder correctly
Changes by Arnout van Meer rr2...@gmail.com: Added file: http://bugs.python.org/file24704/worker.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14174 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14175] broken links on /download/ page
New submission from Florent Xicluna florent.xicl...@gmail.com: The links for the latest RC are broken on the official page. http://www.python.org/download/ And the release page only list 3.2.3 rc1 and forget the other 3: http://www.python.org/download/releases/ -- messages: 154762 nosy: flox priority: normal severity: normal status: open title: broken links on /download/ page type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14175 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
New submission from Jean-Michel Fauth wxjmfa...@gmail.com: Now, that the PEP 414 has been accepted, I can only strongly recommend to fix the problem of unicode literals as a partial workaround. print u'abcœé€' abcé If these six characters are not rendered correctly, you shoud read: LATIN SMALL LETTER A LATIN SMALL LETTER B LATIN SMALL LETTER C LATIN SMALL LIGATURE OE LATIN SMALL LETTER E WITH ACUTE EURO SIGN It is not necessary to give here the list of the numerous libs that do not understand u'unicode literals' as shown above. (I wrote all my Py2 code in a u'unicode mode', and I know how hard it is to have to select between the u'' or unicode() variants. Face it. Python has never worked [*], Python does not work, Python will never work. More important, it is more than clear to me, there is no willingness to solve this issue. (The holy compatibilty with not working code). [*] Except the pure ASCII serie (Py 1.5) and the Python 3[0,1,2] serie. No offense. I'm pretty sure the creator of this PEP is not even able to type on his machine the list of the 42 characters supposed to be available it the typographies (plural) used by the different countries speaking French. The whole free/open source software disaster in all its splendor. Regards. jmf -- components: None messages: 154763 nosy: Jean-Michel.Fauth priority: normal severity: normal status: open title: Fix unicode literals (for PEP 414) versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Nick Coghlan ncogh...@gmail.com added the comment: It occurs to me that one thing that *could* be backported to early versions are some of the documentation improvements on how to correctly handle the lifecycle of fields in Py_buffer. That gets messy though because memoryview doesn't behave nicely in those versions, so we'd be violating our own guidelines. Perhaps the relevant sections should be updated with a reference saying that the semantics have been cleaned up in 3.3, and if in doubt, try to follow the 3.3 documentation? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
Benjamin Peterson benja...@python.org added the comment: What exactly is the bug you're reporting? Python 2.7.2 (default, Oct 27 2011, 22:35:02) [GCC 4.5.3] on linux2 Type help, copyright, credits or license for more information. print u'abcœé€' abcœé€ -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14133] improved PEP 409 implementation
Changes by Patrick Westerhoff patrickwesterh...@gmail.com: -- nosy: +poke ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14133 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Unicode -None nosy: +ezio.melotti type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Antoine Pitrou pit...@free.fr added the comment: I think I’ve always understood “lightweight” to mean “minimal”. Then how about saying minimal instead of lightweight? (also, it seems it really means incomplete or partial, which are of course less positive sounding) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Ezio Melotti ezio.melo...@gmail.com added the comment: Minimal sounds good to me, it also matches the name of the module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14173] PyOS_FiniInterupts leaves signal.getsignal segfaulty
Antoine Pitrou pit...@free.fr added the comment: I needed to modify the script to make it crash under 3.2/3.3. Attaching modified version. Here is the relevant part of the gdb traceback: Program received signal SIGSEGV, Segmentation fault. 0x0052b87b in signal_getsignal (self=module at remote 0x77f43a38, args=(1,)) at ./Modules/signalmodule.c:372 372 Py_INCREF(old_handler); Missing debug package(s), you should install: glibc-debug-2.12.1-11.3.mga1.x86_64 (gdb) bt #0 0x0052b87b in signal_getsignal (self=module at remote 0x77f43a38, args=(1,)) at ./Modules/signalmodule.c:372 #1 0x005f520b in PyCFunction_Call (func= built-in method getsignal of module object at remote 0x77f43a38, arg=(1,), kw=0x0) at Objects/methodobject.c:81 -- nosy: +haypo, pitrou versions: +Python 3.3 -Python 2.6, Python 3.1 Added file: http://bugs.python.org/file24706/sig.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14173 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14170] print unicode string error in win8 cmd console
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4080] unittest: display time of each test case
Ezio Melotti ezio.melo...@gmail.com added the comment: Because it looks like line noise and doesn't provide an useful information in most of the cases (at least for me), see e.g.: + test_format (__main__.MyTestCase) ... [0.000612s] skipped 'not supported in this library version' + test_nothing (__main__.MyTestCase) ... [0.000486s] skipped 'demonstrating skipping' + test_windows_support (__main__.MyTestCase) ... [0.90s] skipped 'requires Windows' It might still be useful to find the slowest test(s), or for test suites that take a long time (so I'm not opposed to having it as an option that can be enabled if needed), but for most of the tests it will just show an almost meaningless fraction of second. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14170] print unicode string error in win8 cmd console
STINNER Victor victor.stin...@gmail.com added the comment: It looks like a duplicate of the issue #11395 which has been fixed in Python 3.2.1, but not backported to Python 2.7. Can you please try your program with Python 3.2.1? And maybe also attach the whole test script? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14170 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4080] unittest: display time used by each test case
Éric Araujo mer...@netwok.org added the comment: Also, when you’re tracking down slow tests, you may want to run your tests with the time needed by each test file and then each test method. Nite that I don’t know of a way to have unittest print each test file to stdout now (i.e. a level of verbosity between “just one dot” and “each method”). -- title: unittest: display time of each test case - unittest: display time used by each test case versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Éric Araujo mer...@netwok.org added the comment: Right, patch for 3.2. Also edited the module docstring (info taken from the docstring of xml.dom). BTW I really think we could have avoided some verbosity by adding the recommendation to use xml.etree in the first paragraph of Doc/library/xml.dom.minidom.rst. -- Added file: http://bugs.python.org/file24707/minidom-desc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Éric Araujo mer...@netwok.org added the comment: s/Mininal/Minimal/ in the synopsis -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11379] Remove lightweight from minidom description
Stefan Behnel sco...@users.sourceforge.net added the comment: Yes, I think that's better. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14172] ref-counting leak in buffer usage in Python/marshal.c
Antoine Pitrou pit...@free.fr added the comment: Here is a patch. -- keywords: +patch nosy: +pitrou, skrah Added file: http://bugs.python.org/file24708/marshalbufs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14172] ref-counting leak in buffer usage in Python/marshal.c
Changes by Antoine Pitrou pit...@free.fr: -- stage: - patch review versions: -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4080] unittest: display time used by each test case
Pawel Prokop pa...@uek.krakow.pl added the comment: I agree with Ezio, this feature should have an option to enable/disable. Anyway, I use it in different way. Since 2008, I've used this feature for performance comparision, whether some implementation changes in application code did not slow down application. Tests run after each commit. I compare execution time of particular test before and after commit. With additional scripts, I create metrics and charts using gnuplot to visualize how execution time of each test changed during the development. I can ensure the performance stability of the application. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14167] document return statement in finally blocks
Yury Selivanov yseliva...@gmail.com added the comment: Well, I guess the best place to put it would be http://docs.python.org/py3k/reference/compound_stmts.html#finally I've attached the patch, please take a look. If it's possible to make it more clear, feel free to rephrase it. But please include the example, this behaviour needs to be emphasized. -- keywords: +patch Added file: http://bugs.python.org/file24709/finally_doc.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14167 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14177] marshal.loads accepts unicode strings
New submission from Antoine Pitrou pit...@free.fr: marshal.loads('T') True marshal.loads(b'T') True Contrast with: marshal.load(io.BytesIO(b'T')) True marshal.load(io.StringIO('T')) Traceback (most recent call last): File stdin, line 1, in module TypeError: f.read() returned not bytes but str -- components: Extension Modules keywords: easy messages: 154778 nosy: pitrou priority: normal severity: normal stage: needs patch status: open title: marshal.loads accepts unicode strings type: behavior versions: Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14177 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14175] broken links on /download/ page
Georg Brandl ge...@python.org added the comment: I fixed the links on /download/ and added the other versions on /releases/. -- nosy: +georg.brandl resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14175 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14178] Failing tests for ElementTree
New submission from Stefan Behnel sco...@users.sourceforge.net: These are tests from lxml's ET compatibility test suite that now fail in ElementTree: def test_delslice_step(self): Element = self.etree.Element SubElement = self.etree.SubElement a = Element('a') b = SubElement(a, 'b') c = SubElement(a, 'c') d = SubElement(a, 'd') e = SubElement(a, 'e') del a[1::2] self.assertEquals( [b, d], list(a)) def test_delslice_step_negative(self): Element = self.etree.Element SubElement = self.etree.SubElement a = Element('a') b = SubElement(a, 'b') c = SubElement(a, 'c') d = SubElement(a, 'd') e = SubElement(a, 'e') del a[::-1] self.assertEquals( [], list(a)) def test_delslice_step_negative2(self): Element = self.etree.Element SubElement = self.etree.SubElement a = Element('a') b = SubElement(a, 'b') c = SubElement(a, 'c') d = SubElement(a, 'd') e = SubElement(a, 'e') del a[::-2] self.assertEquals( [b, d], list(a)) The error messages go like this: del a[1::2] ValueError: attempt to assign sequence of size 0 to extended slice of size 2 del a[::-1] ValueError: attempt to assign sequence of size 0 to extended slice of size 4 del a[::-2] ValueError: attempt to assign sequence of size 0 to extended slice of size 2 Additionally, I get this error: self.assertNotEquals(None, e.code) AttributeError: 'ParseError' object has no attribute 'code' for this test: required_versions_ET['test_feed_parser_error_position'] = (1,3) def test_feed_parser_error_position(self): ParseError = self.etree.ParseError parser = self.etree.XMLParser() try: parser.close() except ParseError: e = sys.exc_info()[1] self.assertNotEquals(None, e.code) self.assertNotEquals(0, e.code) self.assert_(isinstance(e.position, tuple)) self.assert_(e.position = (0, 0)) The complete test suite is here: https://github.com/lxml/lxml/blob/master/src/lxml/tests/test_elementtree.py -- components: Library (Lib), XML messages: 154780 nosy: scoder priority: normal severity: normal status: open title: Failing tests for ElementTree type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14178 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14178] Failing tests for ElementTree
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +eli.bendersky, ezio.melotti, flox stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14178 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0
Joel Verhagen joel.verha...@gmail.com added the comment: There is a difference in what HTTPResponse.getheaders() returns. Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. import httplib c = httplib.HTTPConnection('www.joelverhagen.com') c.request('GET', '/sandbox/tests/cookies.php') c.getresponse().getheaders() [('content-length', '0'), ('set-cookie', 'test_cookie1=foobar; expires=Fri, 02-Mar-2012 16:54:15 GMT, test_cookie2=barfoo; expires=Fri, 02-Mar-2012 16:54:15 GMT'), ('vary', 'Accept-Encoding'), ('server', 'Apache'), ('date', 'Fri, 02 Mar 2012 16:53:15 GMT'), ('content-type', 'text/html')] Python 3.2.2 (default, Sep 4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. from http import client c = client.HTTPConnection('www.joelverhagen.com') c.request('GET', '/sandbox/tests/cookies.php') c.getresponse().getheaders() [('Date', 'Fri, 02 Mar 2012 16:56:40 GMT'), ('Server', 'Apache'), ('Set-Cookie', 'test_cookie1=foobar; expires=Fri, 02-Mar-2012 16:57:40 GMT'), ('Set-Cookie', 'test_cookie2=barfoo; expires=Fri, 02-Mar-2012 16:57:40 GMT'), ('Vary', 'Accept-Encoding'), ('Content-Length', '0'), ('Content-Type', 'text/html')] As you can see, in 2.7.2 HTTPResponse.getheaders() in 2.7.2 joins headers with the same name by , . In 3.2.2, the headers are kept separate and two or more 2-tuples. This causes problems if you convert the list of 2-tuples to a dict, because the keys collide (causing all but one of the values associated the non-unique keys to be overwritten). It looks like this problem is caused by using the email header parser (which keeps the keys and values as separate 2-tuples). In Python 2.7.2, the HTTPMessage.addheader(...) function does the comma-separating. Is this API change intentional? Should HTTPResponse.getheaders() comma-separate the values like the HTTPResponse.getheader(...) function (in both 2.7.2 and 3.2.2)? See also: https://github.com/shazow/urllib3/issues/3#issuecomment-3008415 -- nosy: +joel.verhagen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4773 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
Martin v. Löwis mar...@v.loewis.de added the comment: What operating system and what terminal are you using? If Windows: what code page does your terminal run in? -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14172] ref-counting leak in buffer usage in Python/marshal.c
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 185a6ae76479 by Antoine Pitrou in branch '3.2': Issue #14172: Fix reference leak when marshalling a buffer-like object (other than a bytes object). http://hg.python.org/cpython/rev/185a6ae76479 New changeset b1303cf15e01 by Antoine Pitrou in branch 'default': Issue #14172: Fix reference leak when marshalling a buffer-like object (other than a bytes object). http://hg.python.org/cpython/rev/b1303cf15e01 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14172] ref-counting leak in buffer usage in Python/marshal.c
Antoine Pitrou pit...@free.fr added the comment: Fixed. Apparently 2.7 isn't affected. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14172 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14179] Test coverage for lib/re.py
New submission from Florian M florian.mladit...@googlemail.com: I added one small test in lib/test/test_re.py for complete coverage of 're._compile' method. -- components: Tests files: re_coverage.patch keywords: patch messages: 154785 nosy: flomm priority: normal severity: normal status: open title: Test coverage for lib/re.py versions: Python 3.3 Added file: http://bugs.python.org/file24710/re_coverage.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14179 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14179] Test coverage for lib/re.py
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - patch review type: - enhancement versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14179 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14179] Test coverage for lib/re.py
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - patch review type: - enhancement versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14179 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Roger Serwy roger.se...@gmail.com added the comment: I tried your tk_hello.py code and it works on Python 3. The code for creating the QUIT button exceeds 80 columns. I'd insert a \n after the second argument: self.QUIT = tk.Button(self, text = QUIT, fg = red, command = root.destroy) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Roger Serwy roger.se...@gmail.com added the comment: I tried your tk_hello.py code and it works on Python 3. The code for creating the QUIT button exceeds 80 columns. I'd insert a \n after the second argument: self.QUIT = tk.Button(self, text = QUIT, fg = red, command = root.destroy) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14144] urllib2 HTTPRedirectHandler not forwarding POST data in redirect
Jay Deiman ad...@splitstreams.com added the comment: Senthil, The HTTPRedirectHandler is already breaking RFC2616 by it's own admission in the code comments (from the source): # Strictly (according to RFC 2616), 301 or 302 in response # to a POST MUST NOT cause a redirection without confirmation # from the user (of urllib2, in this case). In practice, # essentially all clients do redirect in this case, so we # do the same. # be conciliant with URIs containing a space I can definitely understand the issue with changing the default behavior to redirect the POST data. However, an added option which leaves the current behavior as the default shouldn't hurt. I'm submitting a new patch file (urllib2.py.redirect_option.patch), which will do exactly that. -- Added file: http://bugs.python.org/file24711/urllib2.py.redirect_option.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14144 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Terry J. Reedy tjre...@udel.edu added the comment: Do you know anything about spaces in the button text causing the addition of {bra ces}? I would prefer not to have to use an underscore in Hello_World. I fixed the long line and also updated pack calls pass options by name instead of a dict. -- Added file: http://bugs.python.org/file24712/tk_hello.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Changes by Terry J. Reedy tjre...@udel.edu: Removed file: http://bugs.python.org/file24693/tk_hello.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Roger Serwy roger.se...@gmail.com added the comment: Ah, that's subtle. There's a comma at the end of that [text] line which is making the string a one-element tuple. Removing it fixes the issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Changes by Terry J. Reedy tjre...@udel.edu: Removed file: http://bugs.python.org/file24712/tk_hello.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14163] tkinter: problems with hello doc example
Terry J. Reedy tjre...@udel.edu added the comment: G, another but in the original ;-) Thank you! I will incorporate into the doc now. -- Added file: http://bugs.python.org/file24713/tk_hello.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
Jean-Michel Fauth wxjmfa...@gmail.com added the comment: I deliberately hid the information about the used interactive interpreter; just to show you the experience of new Python user. (This is what I'm showing to potential Python devs who are interested in this tool; I know Python and use it since v. 1.5.6 as a non computer scientist). The interactive interpreter was: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. In that precise case, it was Windws 7 Pro (Windows 7 Professionnel, in French because of a Swiss French version) and IDLE is just the IDLE an end user see after a fresh installation. I can ensure you, such a behaviour exists / existed on all Windows versions I used (from Win98, win2000, ...) with all the Python 2 versions since the unicode introduction. The technical reasons/aspects: sys.defaultencoding, non iso-8859-1 chars [#], *non working unicode literals*, sys.stdout.encoding = 'cp1252' and so on. [#] For those who do not know, one can not write text in French with Latin-1. Please do not take my aggressive (I recognize it), but sometimes necessary message badly. IDLE is not the cause, I use here IDLE to show as an example the disaster of code containing *unicode literals*. I'm not really happy to see this mess again in Py3.3 [†]; the key point beeing *unicode literals*. The Pandora's box is opened. [†] In fact, I will somehow never see or suffer from it. Decisions have been taken. jmf -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
Georg Brandl ge...@python.org added the comment: Well, let me soothe your mind then: in Python 3, '...' and u'...' will be absolutely equal, so you won't find any more mess with the changes from PEP 414. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14176] Fix unicode literals (for PEP 414)
R. David Murray rdmur...@bitdance.com added the comment: Unless I'm misunderstanding, this is a duplicate of issue 1602. You will note that the problem is *not* with Python (or open source software in general), the problem is that Microsoft treats the command line as a second (or third, or fourth) class citizen. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6784] byte/unicode pickle incompatibilities between python2 and python3
Merlijn van Deen valhall...@gmail.com added the comment: And a complete patch that implements the tests, the python implementation and the C implementation. I'm not completely happy with the code duplication in read_string/read_binstring/read_short_binstring C implementation, so that might be an improvement (however, there is already a lot of code duplication there at the moment). Again: comments would be very welcome... -- Added file: http://bugs.python.org/file24714/pickle_bytestr.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6784 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com