Release 3.2.0 of CodeInvestigator.
CodeInvestigator 3.2.0 was released on August 21. Bug fixes: - Chrome browser: search by value - less memory usage Changes: - nested iterations remain at selected iteration as much as possible - block colors now follow a set pattern - searches are now grouped in subgroups - user can now use middle-click to open functions in a separate tab - user can use refresh back forward and bookmarks - more shortcut keys - printout position retained over iterations - iteration tabs can now be scrolled through You need Python = 2.7 and Firefox or Chrome for CodeInvestigator. CodeInvestigator is a tracing tool for Python programs. Running a program through CodeInvestigator creates a recording. Program flow, function calls, variable values and conditions are all stored for every line the program executes. The recording is then viewed with an interface consisting of the code. The code can be clicked: A clicked variable displays its value, a clicked loop displays its iterations. You read code, and have at your disposal all the run time details of that code. A computerized desk check tool and another way to learn about your program. http://sourceforge.net/project/showfiles.php?group_id=183942 -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Plumbum 1.3 released
http://plumbum.readthedocs.org/en/latest/index.html Ever wished the compactness of shell scripts be put into a real programming language? Say hello to Plumbum Shell Combinators. Plumbum (Latin for lead, which was used to create pipes back in the day) is a small yet feature-rich library for shell script-like programs in Python. The motto of the library is Never write shell scripts again, and thus it attempts to mimic the shell syntax (shell combinators) where it makes sense, while keeping it all Pythonic and cross-platform. Plumbum provides shell-combinators (syntactic sugar) on top of Popen, local and remote process execution, local and remote path manipulation and a powerful optparse/argparse replacement for writing CLI application, Changelog: http://plumbum.readthedocs.org/en/latest/changelog.html -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: Spyder v2.2.3 released
Hi all, On the behalf of Spyder's development team ( http://code.google.com/p/spyderlib/people/list), I'm pleased to announce that Spyder v2.2.3 has been released and is available for Windows XP/Vista/7/8, GNU/Linux and MacOS X: http://code.google.com/p/spyderlib/. This is a maintenance release of the v2.2 branch which is the last release to support Python 2.5: * Spyder 2.2 supports Python 2.5 to 2.7 * Spyder 2.3 will support Python 2.7 to 3.3 * (Spyder 2.3.0dev6 is also available as of today: this is an experimental release but quite stable which already supports Python 3) See also https://code.google.com/p/spyderlib/downloads/list. Since v2.2.2: * Several bug have been fixed (see changelog for further details: https://code.google.com/p/spyderlib/wiki/ChangeLog) * New features have been added like full support for a MATLAB-like cell mode (see Run menu) and the Optional Dependencies dialog box (see menu ?) which gives the user a status of Spyder's dependencies Spyder is a free, open-source (MIT license) interactive development environment for the Python language with advanced editing, interactive testing, debugging and introspection features. Originally designed to provide MATLAB-like features (integrated help, interactive console, variable explorer with GUI-based editors for dictionaries, NumPy arrays, ...), it is strongly oriented towards scientific computing and software development. Thanks to the `spyderlib` library, Spyder also provides powerful ready-to-use widgets: embedded Python console (example: http://packages.python.org/guiqwt/_images/sift3.png), NumPy array editor (example: http://packages.python.org/guiqwt/_images/sift2.png), dictionary editor, source code editor, etc. Description of key features with tasty screenshots can be found at: http://code.google.com/p/spyderlib/wiki/Features Don't forget to follow Spyder updates/news: * on the project website: http://code.google.com/p/spyderlib/ * and on our official blog: http://spyder-ide.blogspot.com/ Last, but not least, we welcome any contribution that helps making Spyder an efficient scientific development/computing environment. Join us to help creating your favourite environment! (http://code.google.com/p/spyderlib/wiki/NoteForContributors) Enjoy! -Pierre -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: About executable
On 25 Aug 2013 21:47, Luis José Novoa luisjoseno...@gmail.com wrote: Hi All. I am trying to create an executable file containing an optimization code using the pyomo package for optimization modeling along with ither packages like Numpy. When using py2exe to perform the task it generates the executable file, but when I try to run it it reports: Import Error: No module named pyomo. Any guidance on how to solve this problem would be really appreciated. Have you checked py2exe's documentation? Bundling external modules with an exe ought to be a very, very, common task. If all else fails, you can try cx_freeze too. I think it generates windows executables too. Good luck! -- http://mail.python.org/mailman/listinfo/python-list
Resetting state of http.client/httplib HTTPSConnection objects
This is a crosspost from python-tutor upon suggestion. I am experiencing intermittent issues where an exception will be raised when calling getresponse(), which makes the entire connection stuck in Request-sent state. Is it possible to reset to idle state somehow without reinstantiating the HTTPSConnection? I ideally want to keep the connection to the server, and just reset the state to idle so that I can make another request (like you would usually do by calling getresponse()). a.conn http.client.HTTPSConnection object at 0x7f8d7cb58bd0 a.conn.getresponse() Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python3.3/http/client.py, line 1143, in getresponse response.begin() File /usr/lib64/python3.3/http/client.py, line 354, in begin version, status, reason = self._read_status() File /usr/lib64/python3.3/http/client.py, line 324, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: '' a.conn.request(GET, foo) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python3.3/http/client.py, line 1061, in request self._send_request(method, url, body, headers) File /usr/lib64/python3.3/http/client.py, line 1089, in _send_request self.putrequest(method, url, **skips) File /usr/lib64/python3.3/http/client.py, line 944, in putrequest raise CannotSendRequest(self.__state) http.client.CannotSendRequest: Request-sent pgpkTDZASsW7A.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Peasy: an easy but powerful parser
I've released Peasy, which is an easy but powerful parser. Peasy brings a new method to write the parser. with Peasy, you write the parser by hand, just like to write any other kind of program. Do not be confused by by hand, with the method brought by Peasy, it's easier and more powerful than using other tools or libraries. Peasy presents itself as a module of single file. To use Peasy, copy peasy.py to your project, read it, modify it, write the grammar rules, and remove any unnecessary stuffs in Peasy, and parse with the grammar. Peasy has an simple, elegant and fast support for direct/indirect left recursive grammar, See [here]( http://chaosim.github.io/peasy/doc/peasy.html#peasysample ) for a concrete sample. The [annotated code]( http://chaosim.github.io/peasy/doc/pypeasy.html ) is best document for Peasy at the moment. -- http://mail.python.org/mailman/listinfo/python-list
Getting request's source site
Hi all, I was wondering how i can get the source from which the request came from. If a user posted a link that directs to my server on facebook i'd like to know that a specific click was from facebook or twitter etc.. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking homogeneity of Array using List in Python
On 2013-08-25, sahil301...@gmail.com sahil301...@gmail.com wrote: I am unable to check homogeneity of Array. I have take Array type Int to be default for my code. Instead of getting Error on NON-INT Values. I want to take input as string. Then check if all input is in (0-9) form, I typecast it into int and Accept. Else, I would like to skip that input. eg. my input is ['1', ' ', 'asdasd231231', '1213asasd', '43242'] I want it to be interpreted as: [1, [None], [None], [None], 43242] NOTE: NO INBUILT FUNCTION BE USED. Impossible. I think. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting request's source site
On Mon, 26 Aug 2013 06:10:41 -0700, Guy Tamir wrote: Hi all, I was wondering how i can get the source from which the request came from. If a user posted a link that directs to my server on facebook i'd like to know that a specific click was from facebook or twitter etc.. That would be the referer header in the HTTP request. (Note that it is an accidental misspelling of referrer.) Including a referrer is not compulsory, so be prepared for it not to be available. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting request's source site
On Mon, Aug 26, 2013 at 11:03 AM, Guy Tamir guytam...@gmail.com wrote: On Monday, August 26, 2013 5:25:49 PM UTC+3, Steven D'Aprano wrote: On Mon, 26 Aug 2013 06:10:41 -0700, Guy Tamir wrote: Hi all, I was wondering how i can get the source from which the request came from. If a user posted a link that directs to my server on facebook i'd like to know that a specific click was from facebook or twitter etc.. That would be the referer header in the HTTP request. (Note that it is an accidental misspelling of referrer.) Including a referrer is not compulsory, so be prepared for it not to be available. -- Steven Thanks for reply, In what cases will i have this header? is there something i can do to enforce having it? Are there any other ways? -- You can look in the server logs if you have them available. If the visitor supplied a referer value in the header, it will be in the log. You don't have any say in this from your end. If you are the creator of your own website you might like to add google analytics to your pages. This is done with a little javascript that google provides. Although there may be a python angle to your question, it isn't apparent yet. http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: python eval function
On Mon, 2013-08-26 at 00:55 +, Steven D'Aprano wrote: On Sun, 25 Aug 2013 23:48:34 +0430, Mohsen Pahlevanzadeh wrote: Dear all, eval doesn't run my code at the following link: http://stackoverflow.com/questions/18432198/eval-function-doesnt-work- in-python Are you asking a question or just sharing a useful link? Thank you before your answer... What question do you want us to answer? The question on Stackoverflow has already been answered correctly: there is no need to use eval (or exec) for this basic task. Also, you're not writing C code. Get rid of the semi-colons, they are just a waste of time, and make you look like an incompetent programmer. Using exec is not the right solution. That is unsafe, if the field name and content come from a database or external input, your code now has a *serious* Code Injection vulnerability. AND it is slow. So you have written slow, unsafe code. Get rid of it, and use setattr like you have already been told: setattr(self, fieldName, fieldValue) -- Steven I didn't post a useful link,i questioned my problem.Of course, At first i put it @stackoverflow then post its link for the following idea: 1. collecting votes for me and someone answered. 2. If anyone have my question in future, can use it. Thank you for answer. --mohsen -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting request's source site
On Monday, August 26, 2013 5:25:49 PM UTC+3, Steven D'Aprano wrote: On Mon, 26 Aug 2013 06:10:41 -0700, Guy Tamir wrote: Hi all, I was wondering how i can get the source from which the request came from. If a user posted a link that directs to my server on facebook i'd like to know that a specific click was from facebook or twitter etc.. That would be the referer header in the HTTP request. (Note that it is an accidental misspelling of referrer.) Including a referrer is not compulsory, so be prepared for it not to be available. -- Steven Thanks for reply, In what cases will i have this header? is there something i can do to enforce having it? Are there any other ways? -- http://mail.python.org/mailman/listinfo/python-list
Python Global variable
Hi all, Please see the below code,in which i'm verifying the global value in python. CHK=10 def test1(): print Value of CHK in test1,CHK def test2(): CHK=40 print Value of CHK in test2,CHK test1() def test3(): global CHK test2() test3() When i ran above code ,I'm getting vlaue of CHK as 40 in test2 method and 10 in test1 method Can somone explain me why the value of CHK is different in method test1 and test2. Best Regards, Chandan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Global variable
On Mon, Aug 26, 2013 at 5:54 AM, chandan kumar chandan_...@yahoo.co.in wrote: Hi all, Please see the below code,in which i'm verifying the global value in python. CHK=10 def test1(): print Value of CHK in test1,CHK def test2(): CHK=40 print Value of CHK in test2,CHK test1() def test3(): global CHK test2() test3() When i ran above code ,I'm getting vlaue of CHK as 40 in test2 method and 10 in test1 method Can somone explain me why the value of CHK is different in method test1 and test2. First, you are using incorrect terminology. You are defining functions here, not methods. A method is a 'function' that is contained within a class. Now, on to your question. You define CHK = 10 at the top of your code. CHK is a name defined within the global namespace of your file. In test1 you print CHK which will be the value of the global CHK. This is because, in python if a referenced name isn't present in the most immediate namespace (test1), it will look in the successive containing namespaces. to find the value. In test2 you create a new name CHK which is not the same as the outer CHK. The test2 CHK is only visible within the function. You assign it the value 40. When it executes, it prints 40. In test3 you let test3 know that CHK refers to the global (outer) name CHK. However when you call test2, you do it with no parameters. test2 knows nothing of your test3 internal names. You need to look up python namespaces, and scoping. I believe these are covered in the python.org tutorial. Be aware that if you learned another language (C, Java) that names will confuse you for a while in python. Best Regards, Chandan -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Global variable
On 26/08/2013 10:54, chandan kumar wrote: Hi all, Please see the below code,in which i'm verifying the global value in python. CHK=10 def test1(): print Value of CHK in test1,CHK def test2(): CHK=40 print Value of CHK in test2,CHK test1() def test3(): global CHK test2() test3() When i ran above code ,I'm getting vlaue of CHK as 40 in test2 method and 10 in test1 method Can somone explain me why the value of CHK is different in method test1 and test2. In a function, if you bind to a name then Python assumes that the name is local to that function unless you declare that it's global. In test1, you refer to 'CHK' but don't bind to it, therefore it's global. In test2, you bind to 'CHK' with 'CHK=40', and you haven't declared that it's global, therefore it's local to test2. In test3, you declare that 'CHK' is global, but don't mention it anywhere else in that function, so it serves no purpose. -- http://mail.python.org/mailman/listinfo/python-list
optparse question (python 2.6)
Hi python-guru's, I am new to Python, coming from a long history of Unix/linux shell programming. I am creating a Python script (In Python 2.6) which should be able to read command line options and arguments. So far, I figured out how to do that with optparse. I can add options (and arguments ) . There are about 7 options that can be selected. However, I can't seem to figure out how to force that only one option is allowed when the script is invoked. In other words: How to restrict the script to accept only one of the available options ? cheers, Andy -- http://mail.python.org/mailman/listinfo/python-list
Re: optparse question (python 2.6)
Andy Kannberg wrote: Hi python-guru's, I am new to Python, coming from a long history of Unix/linux shell programming. I am creating a Python script (In Python 2.6) which should be able to read command line options and arguments. So far, I figured out how to do that with optparse. I can add options (and arguments ) . There are about 7 options that can be selected. However, I can't seem to figure out how to force that only one option is allowed when the script is invoked. In other words: How to restrict the script to accept only one of the available options ? You have to do it manually, like in the example http://docs.python.org/2.6/library/optparse.html#how-optparse-handles-errors if options.a and options.b: parser.error(options -a and -b are mutually exclusive) which could be generalized to (untested) option_names = [foo, bar, baz, ...] toggled_options = [name for name in option_names if getattr(options, name)] if len(toggled_options) 1: s = repr(toggled_options).strip([]) parser.error(options %s are mutually exclusive % s) If you are not restricted to the standard library use https://pypi.python.org/pypi/argparse which was added to the stdlib in 2.7 and has mutually exclusive groups, see http://docs.python.org/2/library/argparse.html#mutual-exclusion -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting request's source site
On Mon, Aug 26, 2013, at 11:03, Guy Tamir wrote: Thanks for reply, In what cases will i have this header? In practice, you'll usually have it, except in cases where the user has bookmarked your site, typed/pasted the URL directly, had it opened by an external program, or taken action to block referers from being sent (this last one is uncommon) is there something i can do to enforce having it? You can refuse to serve the content if it's not present. But this will annoy users since they can't bookmark it or open it from an external program. -- http://mail.python.org/mailman/listinfo/python-list
How come StopIteration.__base__ is not BaseException?
Since StopIteration is not an error, how come does it inherit directly from Exception and not from BaseException? Thanks in advance, Marco -- Marco -- http://mail.python.org/mailman/listinfo/python-list
How to check client shutdown?
I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, for example a KeyboardInterrupt as I frequently use. My code below: ## #server script: class client(threading.Thread): def __init__(self, connection): super(client, self).__init__() self.recv = connection.recv print dir(connection) def start(self): self.run() def run(self): while True: data = self.recv(2000) if data: msg = self.decode(data) print msg #break; def decode(self, data): return pickle.loads(data) class bullet_server: def __init__(self): self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) def start(self): server_address = (localhost, 9006) print '/--server running--/' print server_address self.server.bind(server_address) self.server.listen(5) while True: connection, client_address = self.server.accept() c = client(connection) c.start() if __name__ == '__main__': server = bullet_server() server.start() ## #client script: # set IP and port host = '127.0.0.1' port = 9006 # connect to server connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.connect((host, port)) def loop(): print 'Enter message:' msg = raw_input() encoded = pickle.dumps(msg) connection.send(encoded) loop() loop() -- http://mail.python.org/mailman/listinfo/python-list
Re: How to check client shutdown?
On Tue, Aug 27, 2013 at 5:45 AM, Paul Pittlerson menkomig...@gmail.com wrote: I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, for example a KeyboardInterrupt as I frequently use. My code below: Once the remote end has terminated (as it will presumably do in this case), any attempt to write to the socket will eventually result in an error. You should be able to see that by simple experimentation. Be aware that it might take a bit of time for the error to filter back to you; it depends on whether the remote end actually sends back a RST (reset) packet or not. (In a sane system, hitting Ctrl-C should result in a clean shutdown and proper socket closure, but your server needs to handle the case where it doesn't get one.) Play around with it, you should be able to figure out what it's doing for you. A couple of tangential comments about your script: ## #server script: def decode(self, data): return pickle.loads(data) MAJOR security issue here. You are taking data from a networked source and running it through a trusting system (pickle). This is NOT recommended. Also: You're using a stream socket, and depending - I think - on getting an entire message in a single read() call. This is definitely not guaranteed, though when you're working with localhost it's likely to be true. To make this reliable, you'll need to do something like prefix the message with its length (eg a Hollerith string), or use some system like JSON that lets you detect the end of the message. From the client: def loop(): print 'Enter message:' msg = raw_input() encoded = pickle.dumps(msg) connection.send(encoded) loop() loop() Why recurse? Why not simply loop? No Python has tail-call optimization (as far as I know), so this will eventually blow up with a RuntimeError: maximum recursion depth exceeded. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: How come StopIteration.__base__ is not BaseException?
On Mon, Aug 26, 2013, at 15:37, Marco Buttu wrote: Since StopIteration is not an error, how come does it inherit directly from Exception and not from BaseException? The reason KeyboardInterrupt and SystemExit inherit from BaseException is because you often want them to escape (allowing the program to quit) from code that would otherwise catch them (by catching Exception). On the contrary, StopIteration is almost always used in a context that catches it specifically. -- http://mail.python.org/mailman/listinfo/python-list
Re: Which DLL did fail to load
Wouldn't it better to add a feature to Python to write the name of DLL which load has been failed? If you start Python with the -v (verbose) flag, you can see all the calls to dlopen. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to check client shutdown?
On 26/08/2013 20:45, Paul Pittlerson wrote: I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, for example a KeyboardInterrupt as I frequently use. My code below: [snip] When reading from a socket, it'll return as much data as is available, up to the given limit if specified. If _no_ data is available, then it'll block, unless the socket has been closed at the other end, in which case it'll return zero bytes (an empty bytestring). -- http://mail.python.org/mailman/listinfo/python-list
Re: How to check client shutdown?
On 2013-08-26, Paul Pittlerson menkomig...@gmail.com wrote: I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, recv() will return an empty value of ''. send() will eventually throw an exception. [You may be able to call send() once or twice after the connection has been closed without getting the exception.] On Linux the exception is socket.error with errno 32 (broken pipe). -- Grant Edwards grant.b.edwardsYow! Is this an out-take at from the BRADY BUNCH? gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking homogeneity of Array using List in Python
On 26 August 2013 14:49, Neil Cerutti ne...@norwich.edu wrote: On 2013-08-25, sahil301...@gmail.com sahil301...@gmail.com wrote: eg. my input is ['1', ' ', 'asdasd231231', '1213asasd', '43242'] I want it to be interpreted as: [1, [None], [None], [None], 43242] NOTE: NO INBUILT FUNCTION BE USED. Impossible. I think. class BoilerplateToStopCheating: def __init__(self): Factor things out to prevent cheating. self.digit_to_number = {0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9} def __call__(self, items): def fudging(): More cheat-fudging. for item in items: try: as_number = 0 for char in item: as_number *= 10 as_number += self.digit_to_number[char] yield as_number except KeyError: yield [None] [*z] = fudging() return z converter = BoilerplateToStopCheating() # Can't use print... # Erm... converter(['1', ' ', 'asdasd231231', '1213asasd', '43242']) # Output: [1, [None], [None], [None], 43242] -- http://mail.python.org/mailman/listinfo/python-list
Imaplib Gmail - cannot move from inbox to custom folder (message remains in both)
I am using Imaplib and connecting to a Gmail account. I am issuing commands to copy the email to a custom folder then issuing delete. After expunge message still remains in inbox and customer folder. # COPY EMAIL TO FOLDER copyStatus = m.copy(emailid, 'CIRIMPORTED') print 'id of message copied is: %s status: %s' % (emailid,copyStatus) # SET THE MESSAGE TO HAVE '\Deleted' FLAG (EXPUNGE WILL COMPLETE DELETE PROCESS) storeStatus = m.store(emailid,+FLAGS, r'(\Deleted)') print 'id of message stored is: %s status: %s %s' % (emailid,storeStatus[0],storeStatus[1]) #print '**' #DELETES ANY EMAIL MARKED \Deleted m.expunge() m.close() m.logout() Does anyone have any imaplib code the works with Gmail to move from inbox to another folder? -- http://mail.python.org/mailman/listinfo/python-list
Re: Imaplib Gmail - cannot move from inbox to custom folder (message remains in both)
On 27/08/2013 00:34, r...@attoenterprises.com wrote: I am using Imaplib and connecting to a Gmail account. I am issuing commands to copy the email to a custom folder then issuing delete. After expunge message still remains in inbox and customer folder. # COPY EMAIL TO FOLDER copyStatus = m.copy(emailid, 'CIRIMPORTED') print 'id of message copied is: %s status: %s' % (emailid,copyStatus) # SET THE MESSAGE TO HAVE '\Deleted' FLAG (EXPUNGE WILL COMPLETE DELETE PROCESS) storeStatus = m.store(emailid,+FLAGS, r'(\Deleted)') print 'id of message stored is: %s status: %s %s' % (emailid,storeStatus[0],storeStatus[1]) #print '**' #DELETES ANY EMAIL MARKED \Deleted m.expunge() m.close() m.logout() Does anyone have any imaplib code the works with Gmail to move from inbox to another folder? There's an example in docs which says: M.store(num, '+FLAGS', '\\Deleted') You have: m.store(emailid,+FLAGS, r'(\Deleted)') Could it be that the flags should be r'\Deleted'? -- http://mail.python.org/mailman/listinfo/python-list
Re: Imaplib Gmail - cannot move from inbox to custom folder (message remains in both)
On Monday, August 26, 2013 5:56:09 PM UTC-6, MRAB wrote: On 27/08/2013 00:34, r...@attoenterprises.com wrote: I am using Imaplib and connecting to a Gmail account. I am issuing commands to copy the email to a custom folder then issuing delete. After expunge message still remains in inbox and customer folder. # COPY EMAIL TO FOLDER copyStatus = m.copy(emailid, 'CIRIMPORTED') print 'id of message copied is: %s status: %s' % (emailid,copyStatus) # SET THE MESSAGE TO HAVE '\Deleted' FLAG (EXPUNGE WILL COMPLETE DELETE PROCESS) storeStatus = m.store(emailid,+FLAGS, r'(\Deleted)') print 'id of message stored is: %s status: %s %s' % (emailid,storeStatus[0],storeStatus[1]) #print '**' #DELETES ANY EMAIL MARKED \Deleted m.expunge() m.close() m.logout() Does anyone have any imaplib code the works with Gmail to move from inbox to another folder? There's an example in docs which says: M.store(num, '+FLAGS', '\\Deleted') You have: m.store(emailid,+FLAGS, r'(\Deleted)') Could it be that the flags should be r'\Deleted'? I have tried it with the variations on the web of \\Deleted, r'\Deleted, and \Deleted. The Delete works because I see in the status 'Deleted'. However it does not remove from Inbox. -- http://mail.python.org/mailman/listinfo/python-list
Missing something on exception handling in Python 3
I have code in the pylockfile package that looks roughly like this (apologies for the indentation - I'm growing to dislike Gmail for typing code fragments): try: write_pid_to_lockfile(somefile) except OSError as exc: if conditions_i_can_handle: do_other_stuff... else: raise LockFailed(Failed to create %s % self.path) Thinking I would just get the final exception (not the one I caught originally), I was surprised to see this output on my screen: lock.acquire() Traceback (most recent call last): File lockfile/pidlockfile.py, line 80, in acquire write_pid_to_pidfile(self.path) File lockfile/pidlockfile.py, line 163, in write_pid_to_pidfile pidfile_fd = os.open(pidfile_path, open_flags, open_mode) OSError: [Errno 13] Permission denied: '/tmp/skip/lock' During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 1, in module File lockfile/pidlockfile.py, line 94, in acquire raise LockFailed(failed to create %s % self.path) lockfile.LockFailed: failed to create /tmp/skip/lock When I rung the same code with Python 2.7, I get the exception output I anticipate: lock.acquire() Traceback (most recent call last): File stdin, line 1, in module File lockfile/pidlockfile.py, line 94, in acquire raise LockFailed(failed to create %s % self.path) LockFailed: failed to create /tmp/skip/lock It appears exception handling changed in Python 3. How do I suppress the lower level OSError? Thx, Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing something on exception handling in Python 3
On 27/08/2013 02:48, Skip Montanaro wrote: I have code in the pylockfile package that looks roughly like this (apologies for the indentation - I'm growing to dislike Gmail for typing code fragments): try: write_pid_to_lockfile(somefile) except OSError as exc: if conditions_i_can_handle: do_other_stuff... else: raise LockFailed(Failed to create %s % self.path) Thinking I would just get the final exception (not the one I caught originally), I was surprised to see this output on my screen: lock.acquire() Traceback (most recent call last): File lockfile/pidlockfile.py, line 80, in acquire write_pid_to_pidfile(self.path) File lockfile/pidlockfile.py, line 163, in write_pid_to_pidfile pidfile_fd = os.open(pidfile_path, open_flags, open_mode) OSError: [Errno 13] Permission denied: '/tmp/skip/lock' During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 1, in module File lockfile/pidlockfile.py, line 94, in acquire raise LockFailed(failed to create %s % self.path) lockfile.LockFailed: failed to create /tmp/skip/lock When I rung the same code with Python 2.7, I get the exception output I anticipate: lock.acquire() Traceback (most recent call last): File stdin, line 1, in module File lockfile/pidlockfile.py, line 94, in acquire raise LockFailed(failed to create %s % self.path) LockFailed: failed to create /tmp/skip/lock It appears exception handling changed in Python 3. How do I suppress the lower level OSError? Do this: raise LockFailed(Failed to create %s % self.path) from None -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing something on exception handling in Python 3
Do this: raise LockFailed(Failed to create %s % self.path) from None Thanks. Is there some construct which will work in 2.x and 3.x? Skip -- http://mail.python.org/mailman/listinfo/python-list
TypeError: 'int' object is not callable
dear friends when i try to execute following lines import time a = time.daylight() print(a) result is TypeError: 'int' object is not callable why is this error and how can i solve this problem? -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: 'int' object is not callable
Hi, The problem is in the second line. a = time.daylight() The daylight is not a method in time module. It is clear here, http://docs.python.org/2/library/time.html Since it is not a method we cannot call it. It is just a integer variable . It returns zero if DST timezone is not defined and returns non zero if defined. import time a = time.daylight() Traceback (most recent call last): File stdin, line 1, in module TypeError: 'int' object is not callable a = time.daylight a 0 type(time.daylight) type 'int' Regards, Krishnan On Tue, Aug 27, 2013 at 8:15 AM, autobotprime...@gmail.com wrote: dear friends when i try to execute following lines import time a = time.daylight() print(a) result is TypeError: 'int' object is not callable why is this error and how can i solve this problem? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing something on exception handling in Python 3
On 08/26/2013 07:49 PM, Skip Montanaro wrote: Do this: raise LockFailed(Failed to create %s % self.path) from None Thanks. Is there some construct which will work in 2.x and 3.x? Something like this (untested): exc = None try: write_pid_to_lockfile(somefile) except OSError as exc: exc = sys.exc_info()[0] # not sure of index if exc: if conditions_i_can_handle: do_other_stuff... else: raise LockFailed(Failed to create %s % self.path) Since you're raising outside the try...except block you won't see the chained exception in Python3. -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Phonon error: libv4l2: error getting pixformat: Invalid argument
Here is my code. I'm just trying to play an mp3 that I've clicked in a PyQT listwidget: @pyqtSlot() def item_clicked(self): row = self.listWidget.currentRow() song = musiclist[row] QCoreApplication.setApplicationName(Phonon) output = Phonon.AudioOutput(Phonon.MusicCategory) m_media = Phonon.MediaObject() Phonon.createPath(m_media, output) m_media.setCurrentSource(Phonon.MediaSource(song)) m_media.play() I'm running OpenSUSE Linux 12.3 Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing something on exception handling in Python 3
I found this question/answer on Stack Overflow: http://stackoverflow.com/questions/15123137 but after fiddling around with it, I can't find a solution that works for Python 3.2 and 3.3, let alone 2.x. In 3.2, exceptions have both __cause__ and __context__ attributes. I tried setting both to None (in 3.2), but I still get the full double traceback: try: 1/0 ... except ZeroDivisionError: ...exc = TypeError() ...exc.__context__ = None ...exc.__cause__ = None ...raise exc ... Error in sys.excepthook: IndexError: tuple index out of range Original exception was: Traceback (most recent call last): File stdin, line 1, in module ZeroDivisionError: division by zero During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 6, in module TypeError The sys.excepthook error is because I have a custom interactive sys.excepthook, which is itself apparently broken in Python 3.2. I've looked at PEP 409 and 415, but just get more confused. *sigh* Maybe I'll try again tomorrow when I've had a bit of sleep... and take a closer look at Ethan's suggestion. Skip -- http://mail.python.org/mailman/listinfo/python-list
[issue18836] Potential race condition in exceptions
New submission from Sworddragon: On a try/except-block if an exception raises (for example KeyboardInterrupt) the except block could cause another exception and if this block tries to catch it too the nested except block could cause another exception again. This goes into an unlimited recursion. In the attachments is an example of such a problem (race_condition_fast.py). But as it is called a race condition it is nearly impossible to reproduce it by a human. For this case I have adjusted the example (race_condition_slow.py). The third CTRL + C will cause a KeyboardInterrupt. -- components: Interpreter Core files: race_condition_fast.py messages: 196181 nosy: Sworddragon priority: normal severity: normal status: open title: Potential race condition in exceptions type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file31469/race_condition_fast.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
Changes by Sworddragon sworddrag...@aol.com: Added file: http://bugs.python.org/file31470/race_condition_slow.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18823] Idle: use pipes instead of sockets to talk with user subprocess
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18823 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
Ezio Melotti added the comment: The third CTRL + C will cause a KeyboardInterrupt. This is expected. The first ctrl+c interrupts the first sleep and goes in the second try, executing the second sleep. The second ctrl+c interrupts the second sleep and goes in the second except where it finds the third sleep. Here a third ctrl+c will interrupt the sleep and since this line is not in a try block nothing will catch the KeyboardInterrupt. Are you saying that if the user keeps hitting ctrl+c you would need an endless chain of nested try/except in order to catch them all? -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
Sworddragon added the comment: Are you saying that if the user keeps hitting ctrl+c you would need an endless chain of nested try/except in order to catch them all? Correct. For example if I want to show the user the message Aborted instead of a huge exception if he hits CTRL + C another KeyboardInterrupt could appear. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18837] multiprocessing.reduction is undocumented
New submission from Tomi Pieviläinen: In older versions (2.x, 3.2, 3.3) multiprocessing.reduction was only mentioned in a one example, with a one comment after it. In the 3.4dev documentation even this was dropped. -- assignee: docs@python components: Documentation messages: 196184 nosy: docs@python, tpievila priority: normal severity: normal status: open title: multiprocessing.reduction is undocumented versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18837 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18837] multiprocessing.reduction is undocumented
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +jnoller, sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18837 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: BTW, I also like how short and clean iterparse() becomes when you move this feature into the parser. It's basically just a convenience function that does read(), feed(), and yield-from. Plus the usual bit of bolerplate code, obviously. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Nick Coghlan added the comment: Eli's summary left out an exchange between us that happened after he'd already written the summary - he pointed out the same problem with the EventParser name that you noticed: it's really an alternative XMLParser that exposes read_events(), rather than an event parser. So a completely different name like EventScanner or EventStream may be more appropriate. (I quite like EventStream, since it further suggests the destructive nature of read_events()). As for why we think it's worth keeping this as a separate API, it's really about turning XMLParser's push API for events (where the events are pushed into the target object by the parser calling the appropriate methods), into an iterparse style pull API where the events can be retrieved via calls to read_events(). The back end implementation for the event streaming API *should* be a custom target object combined with a regular XMLParser object, but there are implementation issues currently preventing that. We also discussed adding the event streaming interface directly to XMLParser, but I agreed with Eli that it's worth keeping that base API simple, especially since in the long run we want the new class to just be a convenience API for combining XMLParser and a custom target object, even if it can't be implemented that way right now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: iterparse's parser argument will be deprecated No need to do that. Update the docs, yes, but otherwise keep the possibility to improve the implementation later on, without going through a deprecation + dedeprecation cycle. That would just confuse users IMHO. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Nick Coghlan added the comment: Since parsers don't support changing the target after creation, I think it makes sense to deprecate passing in a parser *instance*, and instead require passing in a callback that accepts the target to use and *returns* an appropriate parser object. The parser can only use the default TreeBuilder as a target. line in the iterparse docs is a sign that this is a more appropriate API - if iterparse needs a particular kind of target, the API should be designed so iterparse *provides* that target instead of saying please don't use a custom target type. However, I don't think it makes sense to provide such a callback based API until it is actually possible to implement the streaming event API using a custom target object with XMLParser. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: I don't see adding one method to XMLParser as a design problem. In fact, it's even a good design on the technical side, because if ET ever gains an HTMLParser, then the implementation of this feature would be highly dependent on the underlying parser, i.e. it would be very different from the implementation in XMLParser. It might not even be supported at all. Moving the API into the parser gives us that choice quite naturally. It also solves the naming issue. Why add another thing to the module that needs explanation (and even an explanation why it's there and how it's different from what else is there), when we can just add the feature to what's there and be done? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: ... instead require passing in a callback that accepts the target ... That could be the parser class then, for example, except that there may be other options to set as well. Plus, it would not actually allow iterparse to wrap a user provided target. So, in fact, that approach doesn't match with the design of introducing a target wrapper. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: it's really about turning XMLParser's push API for events (where the events are pushed into the target object by the parser calling the appropriate methods), into an iterparse style pull API where the events can be retrieved via calls to read_events(). Sorry, but this is ignoring the fact that the target is an *inherent* part of this feature. In fact, the push API of XMLParser forms an integral part of the design. The events that are being collected are a mixture of what the XMLParser produces and what the target produces. You can't think this feature without these two parts. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18838] The order of interactive prompt and traceback on Windows
New submission from Drekin: On Windows, Python 3.3.2, when I run Python as a subprocess via Popen(py -i somescript.py, stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate() and somescript.py ends with exception, there is first interactive promt in stderr output and then the traceback which is reversed to standard order when somescript.py is run interactively directly. Corresponding StackOverflow question: http://stackoverflow.com/questions/18419724/position-of-prompt-in-stderr-after-systemexit . -- components: Windows messages: 196192 nosy: Drekin priority: normal severity: normal status: open title: The order of interactive prompt and traceback on Windows type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18838 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: in the long run we want the new class to just be a convenience API for combining XMLParser and a custom target object, even if it can't be implemented that way right now. Just to be clear: I changed my opinion on this one and I no longer think that it is a good idea. The negative impact on what's there currently is just too large, specifically the user visible deprecation and the change to the target object API. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13107] Text width in optparse.py can become negative
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13107 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18835] Add aligned memroy variants to the suite of PyMem functions/macros
Antoine Pitrou added the comment: Unless the memory allocator actually supports it, this means you lose a whole lot of memory for padding, though... Memory which will sit there unused at the end of another cacheline. Note that the current small object allocator, if not disabled, *should* already return you aligned memory, by construction (each allocation size has dedicated pools from which memory blocks are carved). -- nosy: +haypo, pitrou, tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18839] Wrong sentence in sys.exit.__doc__
New submission from Marco Buttu: Python 3.3:: import sys print(sys.exit.__doc__) exit([status]) Exit the interpreter by raising SystemExit(status). If the status is omitted or None, it defaults to zero (i.e., success). If the status is numeric, it will be used as the system exit status. If it is another kind of object, it will be printed and the system exit status will be one (i.e., failure). The sentence If the status is numeric, it will be used as the system exit status. is wrong:: sys.exit(3.33) 3.33 $ echo $? 1 It should be If the status is an *integer*, it will be used as the system exit status., as specified in the SystemExit `doc`. .. doc: http://docs.python.org/3/library/exceptions.html#SystemExit -- assignee: docs@python components: Documentation messages: 196195 nosy: docs@python, marco.buttu priority: normal severity: normal status: open title: Wrong sentence in sys.exit.__doc__ type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18839 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18835] Add aligned memroy variants to the suite of PyMem functions/macros
STINNER Victor added the comment: The default allocator for PyObject is PyType_GenericAlloc(). If the type has the Py_TPFLAGS_HAVE_GC flag, PyType_GenericAlloc() calls _PyObject_GC_Malloc(). It is the case for the set type. _PyObject_GC_Malloc() adds an header of sizeof(PyGC_Head) (12 bytes on x86) before the PyObject data and then calls PyObject_MALLOC(). By default, Python uses pymalloc for PyObject_MALLOC() which uses an alignment of 8 bytes. For set, I suppose that you are talking about the allocation of the table, not of the set object itself. set_table_resize() uses PyMem_NEW() to allocate the table. If we provide a PyMem_MallocAligned(alignment, size), table entries would be aligned, but not entries of the smalltable. Does it matter? I suggest variants such as PyMem_Alloc32(n) and PyMem_Alloc64(n) to return suitably aligned data blocks. I would prefer a parameter rather than a new function per alignment! Which API does you propose exactly? On Linux, I see at least 3 functions: int posix_memalign(void **memptr, size_t alignment, size_t size); void *valloc(size_t size); void *memalign(size_t boundary, size_t size); Do you propose aligned variant for PyMem, PyMem_Raw and PyObject, or only PyMem? Unless the memory allocator actually supports it, this means you lose a whole lot of memory for padding, though... Memory which will sit there unused at the end of another cacheline. What is the alignment of a cacheline? Can a line starts at any address? Do you have an idea of performance benefit of memory alignment? Adding yet another API to allocate memory has a cost. Python 3.4 already implemented the PEP 445 which added many new functions. If we add new functions, they should conform the PEP 445 (need get/set allocator functions to support hooks to track the memory usage). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18839] Wrong sentence in sys.exit.__doc__
Roundup Robot added the comment: New changeset 187a678c6033 by Ezio Melotti in branch '2.7': #18839: document that sys.exit() will not accept a non-integer numeric value as exit status. http://hg.python.org/cpython/rev/187a678c6033 New changeset 694e50a79638 by Ezio Melotti in branch '3.3': #18839: document that sys.exit() will not accept a non-integer numeric value as exit status. http://hg.python.org/cpython/rev/694e50a79638 New changeset 6cb3ae431bef by Ezio Melotti in branch 'default': #18839: merge with 3.3. http://hg.python.org/cpython/rev/6cb3ae431bef -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18839 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18839] Wrong sentence in sys.exit.__doc__
Ezio Melotti added the comment: Fixed, thanks for the report! -- assignee: docs@python - ezio.melotti nosy: +ezio.melotti resolution: - fixed stage: - committed/rejected status: open - closed type: behavior - enhancement versions: +Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18839 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18408] Fixes crashes found by pyfailmalloc
Roundup Robot added the comment: New changeset 79ce25c70795 by Victor Stinner in branch 'default': Issue #18408: _PyObject_Dump() now saves/restores the current exception http://hg.python.org/cpython/rev/79ce25c70795 New changeset e63f19d0a651 by Victor Stinner in branch 'default': Issue #18664, #18408: Rewrite PyErr_WriteUnraisable() to handle errors http://hg.python.org/cpython/rev/e63f19d0a651 New changeset 8fb3a6f9b0a4 by Victor Stinner in branch 'default': Restore changeset 5bd9db528aed (issue #18408) http://hg.python.org/cpython/rev/8fb3a6f9b0a4 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18664] occasional test_threading failure
Roundup Robot added the comment: New changeset e63f19d0a651 by Victor Stinner in branch 'default': Issue #18664, #18408: Rewrite PyErr_WriteUnraisable() to handle errors http://hg.python.org/cpython/rev/e63f19d0a651 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18834] Add Clang to distutils to build C/C++ extensions
Brett Cannon added the comment: Please upload the patches as files to the issue, that way our review tool can be used. -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18835] Add aligned memroy variants to the suite of PyMem functions/macros
Antoine Pitrou added the comment: What is the alignment of a cacheline? Can a line starts at any address? If it could, Raymond wouldn't be asking for this feature ;-) Cachelines are typically aligned at whatever their size is. So, a 64-byte cacheline will be aligned at a 64 bytes boundary. Perhaps some CPUs operate differently, but mainstream CPUs are generally like that (for good reason: a cache is much simpler to implement if there can't be some overlapping between cache lines). Do you have an idea of performance benefit of memory alignment? Adding yet another API to allocate memory has a cost. Agreed. Aligned memory allocation is useful if your *algorithms* benefit from alignment (e.g. some SIMD-optimized code, or something relying on page tables). But aligning every data structure on a cacheline boundary doesn't sound like a very good idea: if it was, the system allocator would do it for you, IMHO ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
New submission from Donald Stufft: The Python tutorial tells, and even recommends, new users that they can use the pickle module to serialize arbitrary objects. However it does not provide any warning about the insecurity of unpickling arbtirary data. The text even goes so far as to mention sending pickled data over a network connection to other machines. I believe this section should be replaced with using the json module instead of pickle. It is more standard and doesn't present the same security concerns with untrusted data as pickle does. However if it continues to recommend pickle to new users it should at least warn them of the dangers of using pickle. The section in question is located at http://docs.python.org/3/tutorial/inputoutput.html#the-pickle-module -- assignee: docs@python components: Documentation messages: 196203 nosy: docs@python, dstufft priority: normal severity: normal status: open title: Tutorial recommends pickle module without any warning of insecurity ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Fred L. Drake, Jr. added the comment: Advising the reader to be aware of the security warnings in the API documentation seems sufficient. JSON isn't intended to support arbitrary data, and that's what this section is discussing. Another section about data interchange with other applications (regardless of language), may be a reasonable addition, or a good candidate for a separate How-To document that can be referenced. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Donald Stufft added the comment: The section to me just seems to be about how to handle more than just strings, it mentions numbers, lists, dictionaries, and class instances. Of those it mentions, only the class instances are not able to handled out of the box by JSON. However like I said even if it remains pickle this particular area of the documentation should still warn users even though there's already a warning in the API documentation for pickle. As it is if a new user reads this and doesn't click through to the API documentation they've received recommendation from the Python documentation that they can send pickle strings over the network. This is dangerous behavior and the documentation shouldn't be advising new users to do dangerous things by default. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Donald Stufft added the comment: Further more the tutorial claims it's the standard way of persisting data which in my experience it's far from that due to the security concerns. I've seen very little actual use of pickle in the wild (and when it was used it was often used by people who didn't understand the security implications). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] NewInterface
stakingrainbow2 added the comment: NewInterface -- nosy: +stakingrainbow2 title: Remove -mno-cygwin from distutils - NewInterface Added file: http://bugs.python.org/file31471/sa6.html ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11619] On Windows, don't encode filenames in the import machinery
STINNER Victor added the comment: I updated parser_unicode.patch to the last Python version. The new patch has just a minor nit: test_symtable does crash :-D Fixed in new patch: parser_unicode-3.patch -- Added file: http://bugs.python.org/file31472/parser_unicode-3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11619 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1944] Documentation for PyUnicode_AsString (et al.) missing.
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1944 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13655] Python SSL stack doesn't have a default CA Store
Changes by Ludwig Nussel ludwig.nus...@suse.de: -- nosy: +lnussel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13655 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11619] On Windows, don't encode filenames in the import machinery
Changes by STINNER Victor victor.stin...@gmail.com: Removed file: http://bugs.python.org/file21759/parser_unicode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11619 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11619] On Windows, don't encode filenames in the import machinery
Changes by STINNER Victor victor.stin...@gmail.com: Removed file: http://bugs.python.org/file31446/parser_unicode-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11619 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] NewInterface
Changes by PJ Eby p...@telecommunity.com: Removed file: http://bugs.python.org/file31471/sa6.html ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Remove -mno-cygwin from distutils
Changes by PJ Eby p...@telecommunity.com: -- title: NewInterface - Remove -mno-cygwin from distutils ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Fred L. Drake, Jr. added the comment: When I read ... that can take almost any Python object ..., I don't think the recommendation is about just a few types. The Zope and ZODB communities certainly use pickle extensively, we're aware of the security implications, and we send pickled data over the network all the time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18606] Add statistics module to standard library
Steven D'Aprano added the comment: I have changed the algorithm for statistics.sum to use long integer summation of numerator/denominator pairs. This removes the concerns Mark raised about the float addition requiring correct rounding. Unless I've missed something, this now means that statistics.sum is now exact, including for floats and Decimals. The cost is that stats.sum(ints) is a little slower, sum of Decimals is a lot slower (ouch!) but sum of floats is faster and of Fractions a lot faster. (Changes are relative to my original implementation.) In my testing, algorithmic complexity is O(N) on the number of items, at least up to 10 million items. -- Added file: http://bugs.python.org/file31473/statistics_newsum.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18606 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Donald Stufft added the comment: A description of the pickle module itself does not equate to the purpose of the section. Given that this is a tutorial and previous section taught how to read and write from files I would suggest that the purpose of the section was to give them the next step to persisting data which could be pickle or it could be JSON (or it could be another format all together). I don't see what Zope/ZODB's awareness of the security implications has to do with anything unless you're trying to state that the developers and users of ZODB are newcomers to Python whose knowledge of pickle stems from what they read in the tutorial. However I am glad that those communities are aware of the implications if they are using that module, but the point is the reader of the tutorial is *not* likely to be aware of them and should *not* be using pickle without being aware of them especially if they are sending that data over the network. I'm really not sure what your problem is here. What is there to lose by annotating this section of the tutorial with a similar warning as exists in the pickle documentation that they should not unpickle data from an untrusted or unauthenticated sources? I can see how someone could state that the problem with switching to JSON is that it's harder to construct a serialization for arbitrary objects. That's not something I think it all that important to teach someone brand new to Python however I can understand if switching this section to using a safe serialization format doesn't sit well with people which is why I suggested at least adding a warning. So what exactly is your problem with at a minimum adding a warning? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18829] csv produces confusing error message when passed a non-string delimiter
Vajrasky Kok added the comment: Apparently, other attributes of the csv dialect beside delimiter, such as escapechar and quotechar share the same problem. import _csv _csv.reader('foo', quotechar=b'') Traceback (most recent call last): File stdin, line 1, in module TypeError: quotechar must be set if quoting enabled _csv.reader('foo', escapechar=b'+') _csv.reader object at 0x7fa85d7847d0Traceback (most recent call last): File stdin, line 1, in module TypeError: bad argument type for built-in operation My patch already fixed the problem, only lacked the unit test. But since this ticket is about delimiter, I'll create the unit test for quotechar and escapechar in separate ticket after this ticket has been closed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18829 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18841] math.isfinite fails with Decimal sNAN
New submission from Steven D'Aprano: math.isfinite currently raises ValueError when given a Decimal sNAN (signalling NAN). I've run into a situation where I'm calling isfinite() on a numeric value which may be a Decimal sNAN, and it would be nice if it returned False. On the other hand, see the discussion on issue 15544, which possibly leads to the conclusion that raising ValueError is the right thing to do. http://bugs.python.org/issue15544 Either way, behaviour should be documented. -- assignee: docs@python components: Documentation, Library (Lib) messages: 196213 nosy: docs@python, stevenjd priority: normal severity: normal status: open title: math.isfinite fails with Decimal sNAN type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18841 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Antoine Pitrou added the comment: I would be ok with changing that part of the tutorial to use json. Since json is much better known outside of the Python programming circles, and since its output is human-readable, it's probably a better fit for the tutorial. pickle can be mentioned as a more powerful and more dangerous alternative. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
R. David Murray added the comment: Then you catch KeyboardInterrupt and present your alternate text. I'm not following what the problem is. In particular, once you've caught KeyboardInterrupt, a second ctl-C *should* cause a normal program break, otherwise you've locked the user into a infinite loop he can't get out of if your program logic is wrong. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Remove -mno-cygwin from distutils
Changes by Éric Araujo mer...@netwok.org: -- Removed message: http://bugs.python.org/msg196207 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18838] The order of interactive prompt and traceback on Windows
R. David Murray added the comment: For anyone who wants to look in to this: according to the stack overflow question and comments, this is a behavior change between python2 and python3. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18838 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18830] Remove duplicates from a result of getclasstree()
Éric Araujo added the comment: +1 -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18830 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Antoine Pitrou added the comment: By the way, there is one difference between json and pickle in this context: json will output a text serialization, pickle a binary one. If serializing to a binary file, users must do the (utf-8, most likely) encoding themselves. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18842] Add float.is_finite is_nan is_infinite to match Decimal methods
New submission from Steven D'Aprano: On issue 15544 Mark Dickinson suggested adding methods to float to match methods on Decimal, giving type-agnostic ways of testing real numbers that don't rely on converting to float. I don't see any sign that Mark raised a feature request, so I'm taking the liberty of doing so myself. Note that the math.is* functions convert to float first, which means that they behave differently. Example: math.isnan(Decimal('sNAN')) raises ValueError, rather than returning True. float.is_nan float.is_infinity float.is_finite would mirror the spelling of Decimal methods, rather than the math module. As float doesn't support signalling NANs, there probably isn't any need to include is_snan and is_qnan. For what it's worth, I have code that would use this. I currently write something like: if isinstance(x, Decimal) and x.is_nan() or math.isnan(x): ... in order to prevent triggering the ValueError on signalling NANs. -- messages: 196219 nosy: stevenjd priority: normal severity: normal status: open title: Add float.is_finite is_nan is_infinite to match Decimal methods type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18842 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Eli Bendersky added the comment: On Sun, Aug 25, 2013 at 10:40 PM, Stefan Behnel rep...@bugs.python.orgwrote: Stefan Behnel added the comment: Hmm, did you look at my last comment at all? It solves both the technical issues and the API issues very nicely and avoids any problems of potential future changes. Let me quickly explain why. The feature in question depends on two existing parts of the API: the event generation of the parser, and the return values of the parser target (e.g. a tree builder). So there are really only three places where this feature makes sense, both technically and API-wise. 1) in the target 2) in the parser 3) between parser and target Note how a separate class is ruled out right from the start by the fact that the feature lives somehwere between parser and target. It's an inherent part of the existing design already (and of the implementation, BTW), so I don't see how adding a separate thing to control it makes any sense. 1) is impossible because the target is user provided and we do not control it 2) works fine because the parser controls both the call to the target and its return value 3) would be nice (and was my original favourite) but is hard to do with the current implementation and requires further changes to the API of parser targets So 2) is the choice that remains. I think folding it all into XMLParser is a bad idea. XMLParser is a fairly simple API and I don't want to complicate it. But more importantly, XMLParser knows nothing about Elements, at least in the direct API of today. The one constructing Elements is the target. The read_events method proposed for the new class (currently IncrementalParser.events) already returns Elements, having used a TreeBuilder to build them. XMLParser emits start/end/data calls into the target, but these only carry tag names, attributes and chunks of data. The hierarchical element construction is done by TreeBuilder. What I actually think would be better for the long term is to add new target invocations in XMLParser - start-ns and end-ns. So XMLParser would just keep *parsing*, leaving the interpretation of the parsed data to the target. Today's TreeBuilder is free to ignore these calls. A custom EventCollectingTreeBuilder can collect an event list, having all the information at its disposal. Thus, XMLParser would remain what it is today (minus the _setevents hack) - a router for pyexpat events. These discussions of the future API are interesting, but what's more important today is to have an API for IncrementalParser (using this name before a new one is agreed upon) that doesn't block future implementation changes. And I believe the API proposed here fits the bill. The class will be named EventParser. Obviously because it's parsing Events, as opposed to the XMLParser, which parses XML, or the HTMLParser, which parses HTML, right? The name is not perfect, and proposals for a better one are welcome. FWIW, since it already lives in the xml.etree namespace, XML does not necessarily have to be part of the name. So, some alternatives: * EventStreamer - proposed by Nick. I have to admit I don't feel good with it, because I still want to be crystal clear it's a *parser* we're talking about. * EventBasedParser * EventCollectingParser * NonblockingParser * ... other ideas? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
Sworddragon added the comment: The problem is simple: It is not possible to catch every exception in an application. Even if you try to print a message and exit on an exception it is always possible that the user will see a traceback. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689
New submission from Martin Mokrejs: Hi, it happened to me that using faulthandler and python compiled with --with-pydebug and C*FLAGS=-ggdb I got this stacktrace (will attach longer version as a file): (gdb) where #0 0x7f0e3af8aacb in raise () from /lib64/libpthread.so.0 #1 0x7f0e3a0b05f6 in faulthandler_fatal_error (signum=6) at faulthandler.c:321 #2 signal handler called #3 0x7f0e3ac061f5 in raise () from /lib64/libc.so.6 #4 0x7f0e3ac0766b in abort () from /lib64/libc.so.6 #5 0x7f0e3b327828 in Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Python/pythonrun.c:1689 #6 0x7f0e3b257dc8 in _PyObject_DebugCheckAddressApi (api=111 'o', p=0x449e6900) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/obmalloc.c:1591 #7 0x7f0e3b257a6c in _PyObject_DebugFreeApi (api=111 'o', p=0x449e6900) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/obmalloc.c:1478 #8 0x7f0e3b257913 in _PyObject_DebugFree (p=0x449e6900) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/obmalloc.c:1422 #9 0x7f0e3b34319a in PyObject_GC_Del (op=0x449e6920) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/gcmodule.c:1561 #10 0x7f0e3b275ef7 in tupledealloc (op=0x449e6920) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/tupleobject.c:235 #11 0x7f0e3b255bac in _Py_Dealloc (op=(True,)) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/object.c:2262 #12 0x7f0e3b246d77 in dict_dealloc (mp=0x449b5d80) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/dictobject.c:1010 #13 0x7f0e3b255bac in _Py_Dealloc (op= {'_label': unknown at remote 0x449dd4b8, '_facecolors_original': (float at remote 0xb65dd38, float at remote 0x5034630, float at remote 0xb3c6af8), '_transform': unknown at remote 0x449e6b50, 'figure': Figure(_label='', _transform=None, figure=None, _axobservers=[], images=[], texts=[], _hold=True, artists=[], _agg_filter=None, patch=Rectangle(_label='', _transform=BboxTransformTo(_invalid=2, _inverted=Affine2D(_invalid=0, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bc6ec0, _shorthand_name='', _parents=WeakValueDictionary(_remove=function at remote 0xbf7d060, data={}) at remote 0x129fbdf8) at remote 0xd5bb0300, _boxout=TransformedBbox(_invalid=2, _transform=Affine2D(_invalid=2, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bad540, _shorthand_name='', _parents=WeakValueDictionary(_remove=function at remote 0xc166450, data={741848704: KeyedRef at remote 0x40290a80, 405520480: KeyedRef at remote 0x29e86b10, 322803328: KeyedRef at remote 0x29e 86570, 3585872752: KeyedRef ...(truncated)) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/object.c:2262 #14 0x7f0e3b27ad3d in subtype_dealloc ( self=PathCollection(_label=unknown at remote 0x449dd4b8, _facecolors_original=(float at remote 0xb65dd38, float at remote 0x5034630, float at remote 0xb3c6af8), _transform=unknown at remote 0x449e6b50, figure=Figure(_label='', _transform=None, figure=None, _axobservers=[], images=[], texts=[], _hold=True, artists=[], _agg_filter=None, patch=Rectangle(_label='', _transform=BboxTransformTo(_invalid=2, _inverted=Affine2D(_invalid=0, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bc6ec0, _shorthand_name='', _parents=WeakValueDictionary(_remove=function at remote 0xbf7d060, data={}) at remote 0x129fbdf8) at remote 0xd5bb0300, _boxout=TransformedBbox(_invalid=2, _transform=Affine2D(_invalid=2, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bad540, _shorthand_name='', _parents=WeakValueDictionary(_remove=function at remote 0xc166450, data={741848704: KeyedRef at remote 0x40290a80, 405520480: KeyedRef at remote 0x29e86b10, 322803328: KeyedRef at remo te 0x29e86570, 3585872752: KeyedR...(truncated)) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/typeobject.c:1015 #15 0x7f0e3b255bac in _Py_Dealloc ( op=PathCollection(_label=unknown at remote 0x449dd4b8, _facecolors_original=(float at remote 0xb65dd38, float at remote 0x5034630, float at remote 0xb3c6af8), _transform=unknown at remote 0x449e6b50, figure=Figure(_label='', _transform=None, figure=None, _axobservers=[], images=[], texts=[], _hold=True, artists=[], _agg_filter=None, patch=Rectangle(_label='', _transform=BboxTransformTo(_invalid=2, _inverted=Affine2D(_invalid=0, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bc6ec0, _shorthand_name='', _parents=WeakValueDictionary(_remove=function at remote 0xbf7d060, data={}) at remote 0x129fbdf8) at remote 0xd5bb0300, _boxout=TransformedBbox(_invalid=2, _transform=Affine2D(_invalid=2, _inverted=None, _mtx=numpy.ndarray at remote 0xd5bad540, _shorthand_name='',
[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689
Martin Mokrejs added the comment: Should have included from the head of gdb output: Program terminated with signal 6, Aborted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18843 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4705] python3.0 -u: unbuffered stdout
Joe Borg added the comment: Can I confirm this is still in the trunk? I have 3.3.2 and am suffering from the fact that `-u` isn't setting stdin to unbuffered. I'm have to run a flush every command, which is awful. -- nosy: +Joe.Borg, georg.brandl versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18836] Potential race condition in exceptions
R. David Murray added the comment: I wonder if you could achieve what you want (which I always hope programs I use never do[*]) by writing your own signal handler. In any case, I don't believe there is a bug here. This is working as designed. [*] There are many times I have found myself leaning on ctl-C on autorepeat hoping that the ctl-c will happen at a point where the application isn't catching it, so that I can get the darn thing to abort. I realize you are proposing to do this only to then do the abort...but what if there is a bug in your code? I'd *much* rather see a traceback than have to fall back to 'kill'. At least with the traceback I know the interpreter has had a chance to clean up. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18836 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689
Amaury Forgeot d'Arc added the comment: This is a memory corruption. Please look at the memory before the freed address (0x449e6900), maybe there is an indication of some buffer overflow? -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18843 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689
Martin Mokrejs added the comment: Would you please guide me what gdb commands I should issue for you? Thank you. BTW, I ran memtest86+ few days ago, although this is non-ECC memory I think HW is fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18843 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689
Martin Mokrejs added the comment: Grr, forgot to look into a file where I recorded STDERR. Debug memory block at address p=0x449e6900: API 'o' 80 bytes originally requested The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfb): at p-7: 0xfb at p-6: 0xfb at p-5: 0xfa *** OUCH at p-4: 0xfb at p-3: 0xfb at p-2: 0xfb at p-1: 0xfb Because memory is corrupted at the start, the count of bytes requested may be bogus, and checking the trailing pad bytes may segfault. The 8 pad bytes at tail=0x449e6950 are FORBIDDENBYTE, as expected. The block was made by call #8155854715 to debug malloc/realloc. Data at p: 00 00 00 00 00 00 00 00 ... 20 af 5b 3b 0e 7f 00 00 Fatal Python error: bad leading pad byte Fatal Python error: Aborted Current thread 0x7f0e3b7ec700: File /usr/lib64/python2.7/site-packages/matplotlib/axes.py, line 932 in cla File /usr/lib64/python2.7/site-packages/matplotlib/figure.py, line 906 in clf File /usr/lib64/python2.7/site-packages/matplotlib/figure.py, line 926 in clear File blah.py, line 12513 in draw_hist2d_plot In that function I call: del(_series) del(_ax1) _figure.clear() # 12513 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18843 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18844] allow weights in random.choice
New submission from Alan Isaac: The need for weighted random choices is so common that it is addressed as a common task in the docs: http://docs.python.org/dev/library/random.html This enhancement request is to add an optional argument to random.choice, which must be a sequence of non-negative numbers (the weights) having the same length as the main argument. -- messages: 196229 nosy: aisaac priority: normal severity: normal status: open title: allow weights in random.choice type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18844 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18828] urljoin behaves differently with custom and standard schemas
Madison May added the comment: From urllib.parse: uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', 'prospero', 'rtsp', 'rtspu', '', 'sftp', 'svn', 'svn+ssh'] From urllib.parse.urljoin (scheme='redis' and url='/1' in your example): if scheme != bscheme or scheme not in uses_relative: return _coerce_result(url) Should the 'redis' scheme be added to uses_relative, perhaps? -- nosy: +madison.may ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18828 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17741] event-driven XML parser
Stefan Behnel added the comment: XMLParser knows nothing about Elements, at least in the direct API of today. The one constructing Elements is the target. Absolutely. And I'm 100% for keeping that distinction exactly as it is. The read_events method proposed for the new class (currently IncrementalParser.events) already returns Elements, having used a TreeBuilder to build them. More precisely, it only returns Elements *iff* the TreeBuilder builds them. If it does not, then it returns something else. By moving the desired functionality into the parser, we don't even need to change anything about the interface between the parser and the target object. We still can, though, if you want to extend the interface with start-ns and end-ns events (and I'm ok with that, but it's a different feature). We do not loose that option. But the cool thing is that we don't have to do this now, and that iterparse just keeps working as it is and can be fixed later. No deprecation needed. So we can easily agree on the goals of keeping the interface of the XMLParser simple and not teaching it about Elements. But we still disagree about the conclusions. My conclusion is that the API is substantially simpler if we do *not* add an entire new class that just duplicates existing APIs, but keep the parser as the thing that generates parse events. Be they in the form of callbacks or in the form of event tuples (that have the same name as the callbacks, BTW). The cool feature is that you can use either of the two interfaces or even hook into one to control the other (once the C parser is fixed), without having to learn the distinction between an XMLParser and a WhateverNewParser that also just parses XML. I still want to be crystal clear it's a *parser* we're talking about You have to decide what you want. IMHO, there is no use in putting a new parser next to the existing XMLParser if both are there for parsing XML. That is just unnecessarily confusing. If you want it to be a parser, use the XMLParser. I guess there's no other way to convince you than by coding up my proposal. It seems to be hard to properly explain it without seeing it at work. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com