Leo 5.0 beta 2 released
Leo 5.0b2 is now available at: http://sourceforge.net/projects/leo/files/Leo/ This release fixes several installation issues and updates installation instructions for Linux/Ubuntu. Leo is a PIM, an IDE and an outliner. Video tutorials: http://leoeditor.com/screencasts.html Text tutorials: http://leoeditor.com/tutorial.html The highlights of Leo 5.0 -- * Better compatibility with vim, Emacs, pylint and PyQt: - Optional native emulation of vim commands. - Full support for Emacs org-mode outlines. - Full support for Vim .otl outlines. - Better support for pylint. - Support for both PyQt4 and PyQt5. * Better handling of nodes containing large text: - Idle time syntax coloring eliminates delay. - Optional delayed loading of large text. * Power features: - Command history for minibuffer commands. - Leo available via github repository. - File name completion. - Cloned nodes expand and contract independently. - @data nodes can be composed from descendant nodes. - No need to change Leo's main style sheet: it can be customized with @color and @font settings. - @persistence nodes save data in @auto trees. - A pluggable architecture for @auto nodes. - The style-reload command changes Leo's appearance instantly. * Important new plugins for tagging, display and node evaluation. * For beginners: - Leo's default workbook files contains Leo's quickstart guide. * Hundreds of new/improved features and bug fixes. Links: -- Leo: http://leoeditor.com Docs: http://leoeditor.com/leo_toc.html Tutorials: http://leoeditor.com/tutorial.html Videos:http://leoeditor.com/screencasts.html Forum: http://groups.google.com/group/leo-editor Download: http://sourceforge.net/projects/leo/files/ Github:https://github.com/leo-editor/leo-editor Quotes:http://leoeditor.com/testimonials.html -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: How modules work in Python
First, I'll repeat everybody else: DON'T TOP POST!!! On 11/16/2014 04:41 PM, Abdul Abdul wrote: Dave, Thanks for your nice explanation. For your answer on one of my questions: *Modules don't have methods. open is an ordinary function in the module.* Isn't method and function used interchangeably? In other words, aren't they the same thing? Or, Python has some naming conventions here? You've already received answers to this, but a short example might clarify the difference: #--- Code # Define a function def func1(): print('This is function func1()') # Define a class with a method class Examp: def func2(self): print('This is method func2()') # Try them out obj = Examp() # Create an object (an instance of class Examp) func1()# Call the function obj.func2()# Call the method through the object func2()# Try to call the method directly -- Error! #--- /Code This code results in the following: This is function func1() This is method func2() Traceback (most recent call last): File fun-meth.py, line 14, in module func2() NameError: name 'func2' is not defined -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
Re: caught in the import web again
On Tue, 18 Nov 2014 00:00:42 -0700, Michael Torrie wrote: On 11/17/2014 03:45 PM, Steven D'Aprano wrote: Circular dependencies are not just a problem in Python, they are a problem throughout most of software design. Personally I find that duck typing eliminates a lot of the circular dependency problems. Class A doesn't necessarily have to know about Class B to work with instances of Class B. All that has to be known is what methods are going to be available on those instances. The interface pattern can help here if you wanted a bit more safety (like what Zope provides). Either way it breaks up the dependency cycle nicely. If Class A needs to instantiate instances of Class B (which depends on Class A), then it could call a factory method to do so, perhaps set up by a third party after both modules have been imported. There are lots of methods of avoiding the issue entirely. In the C or C++ world, I find that signalling frameworks can also be used to break a dependency cycle. For example, if Class A needs to call a method on an instance of Class B (which in turn depends on Class A), that could be done instead as a signal, which is later connected to Class B's method after everything is successfully instantiated. Also makes testing a bit easier, because you can simply hook up the signals to a test harness. A bunch of useful thoughts. Thanks, folks! -- https://mail.python.org/mailman/listinfo/python-list
How to access Qt components loaded from file?
I have this simple code that load any Qt Designer .UI file: from PySide.QtCore import QFile from PySide.QtGui import QApplication from PySide.QtUiTools import QUiLoader def loadui(file_name): loader = QUiLoader() uifile = QFile(file_name) uifile.open(QFile.ReadOnly) ui = loader.load(uifile) uifile.close() return ui if __name__ == __main__: import sys app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.show() app.exec_() Let's say I have a QTextEdit called txtbox. How can I access this txtbox inside my Python code? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
Le 18/11/2014 13:18, Juan Christian a écrit : I have this simple code that load any Qt Designer .UI file: from PySide.QtCore import QFile from PySide.QtGui import QApplication from PySide.QtUiTools import QUiLoader def loadui(file_name): loader = QUiLoader() uifile = QFile(file_name) uifile.open(QFile.ReadOnly) ui = loader.load(uifile) uifile.close() return ui if __name__ == __main__: import sys app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.show() app.exec_() Let's say I have a QTextEdit called txtbox. How can I access this txtbox inside my Python code? How about MainWindow.txtbox ? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
Many thanks, worked. The only problem now is that I don't have auto-complete for anything, because of this approach... I'll have to check the doc more regularly. ^^ On Tue Nov 18 2014 at 10:48:44 AM Vincent Vande Vyvre vincent.vande.vy...@telenet.be wrote: Le 18/11/2014 13:18, Juan Christian a écrit : I have this simple code that load any Qt Designer .UI file: from PySide.QtCore import QFile from PySide.QtGui import QApplication from PySide.QtUiTools import QUiLoader def loadui(file_name): loader = QUiLoader() uifile = QFile(file_name) uifile.open(QFile.ReadOnly) ui = loader.load(uifile) uifile.close() return ui if __name__ == __main__: import sys app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.show() app.exec_() Let's say I have a QTextEdit called txtbox. How can I access this txtbox inside my Python code? How about MainWindow.txtbox ? -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
ANN: Leo 5.0 beta 2 released
Leo 5.0b2 is now available at: http://sourceforge.net/projects/leo/files/Leo/ This release fixes several installation issues and updates installation instructions for Linux/Ubuntu. Leo is a PIM, an IDE and an outliner. Video tutorials: http://leoeditor.com/screencasts.html Text tutorials: http://leoeditor.com/tutorial.html The highlights of Leo 5.0 -- * Better compatibility with vim, Emacs, pylint and PyQt: - Optional native emulation of vim commands. - Full support for Emacs org-mode outlines. - Full support for Vim .otl outlines. - Better support for pylint. - Support for both PyQt4 and PyQt5. * Better handling of nodes containing large text: - Idle time syntax coloring eliminates delay. - Optional delayed loading of large text. * Power features: - Command history for minibuffer commands. - Leo available via github repository. - File name completion. - Cloned nodes expand and contract independently. - @data nodes can be composed from descendant nodes. - No need to change Leo's main style sheet: it can be customized with @color and @font settings. - @persistence nodes save data in @auto trees. - A pluggable architecture for @auto nodes. - The style-reload command changes Leo's appearance instantly. * Important new plugins for tagging, display and node evaluation. * For beginners: - Leo's default workbook files contains Leo's quickstart guide. * Hundreds of new/improved features and bug fixes. Links: -- Leo: http://leoeditor.com Docs: http://leoeditor.com/leo_toc.html Tutorials: http://leoeditor.com/tutorial.html Videos:http://leoeditor.com/screencasts.html Forum: http://groups.google.com/group/leo-editor Download: http://sourceforge.net/projects/leo/files/ Github:https://github.com/leo-editor/leo-editor Quotes:http://leoeditor.com/testimonials.html -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
I was doing some tests, then I tried this: app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) MainWindow.show() app.exec_() But I get RuntimeError: Failed to connect signal clicked()., why? The syntax is correct, I don't know why it failed, the btn is in the Form too, it's a QPushButton. The test func is just a simple func that returns a random text. On Tue Nov 18 2014 at 11:08:48 AM Juan Christian juan0christ...@gmail.com wrote: Many thanks, worked. The only problem now is that I don't have auto-complete for anything, because of this approach... I'll have to check the doc more regularly. ^^ On Tue Nov 18 2014 at 10:48:44 AM Vincent Vande Vyvre vincent.vande.vy...@telenet.be wrote: Le 18/11/2014 13:18, Juan Christian a écrit : I have this simple code that load any Qt Designer .UI file: from PySide.QtCore import QFile from PySide.QtGui import QApplication from PySide.QtUiTools import QUiLoader def loadui(file_name): loader = QUiLoader() uifile = QFile(file_name) uifile.open(QFile.ReadOnly) ui = loader.load(uifile) uifile.close() return ui if __name__ == __main__: import sys app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.show() app.exec_() Let's say I have a QTextEdit called txtbox. How can I access this txtbox inside my Python code? How about MainWindow.txtbox ? -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: caught in the import web again
On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel da...@davea.name wrote: Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: In a module that might get tangled in a cycle, avoid global code that depends on other modules. Instead of putting such initialization at top level, put inside a function that gets called after all suspect imports are completed. (That function has global keywords ). If the problem is that one of those modules would import the current module, then after all suspect imports are completed basically means after the current module has finished importing. So what would be responsible for calling such a function? If one builds a set of modules that cannot avoid recursive imports, then one can ask the code that imports it to make a call after importing. Or all that is needed to avoid exposing the mess is that the top level not be part of the loops. This would make the module less reusable though, since the first other module to import it in one program might still be used in another program but not be the first other module to import it. Or I suppose for simplicity it could be required that all importers call the initialization function, and have the function return immediately if it's been called previously. However, I don't think there's any way to do this without ending up with smelly code. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
Le 18/11/2014 15:49, Juan Christian a écrit : I was doing some tests, then I tried this: app = QApplication(sys.argv) MainWindow = loadui(main.ui) MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) MainWindow.show() app.exec_() But I get RuntimeError: Failed to connect signal clicked()., why? The syntax is correct, I don't know why it failed, the btn is in the Form too, it's a QPushButton. The test func is just a simple func that returns a random text. On Tue Nov 18 2014 at 11:08:48 AM Juan Christian juan0christ...@gmail.com mailto:juan0christ...@gmail.com wrote: Many thanks, worked. The only problem now is that I don't have auto-complete for anything, because of this approach... I'll have to check the doc more regularly. ^^ https://mail.python.org/mailman/listinfo/python-list You can't have a slot like this: MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) because that's mean: connect to the return of MainWindow.txtbox.setText(test()) and it's not possible at this stage of your program. Use instead a function: MainWindow.btn.clicked.connect(my_slot) # No parenthesis ! def my_slot(): MainWindow.txtbox.setText(test()) -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
You can't have a slot like this: MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) because that's mean: connect to the return of MainWindow.txtbox.setText(test()) and it's not possible at this stage of your program. Use instead a function: MainWindow.btn.clicked.connect(my_slot) # No parenthesis ! def my_slot(): MainWindow.txtbox.setText(test()) Thanks, it's working. What would be a professional approach if I want to constantly call a URL to get it's content and access this data within the GUI? I mean, when I run the program I'm locked in the app.exec_() continuous loop right? So I can't have a loop to get this data from the web, is there any special signal/slot regarding this? -- https://mail.python.org/mailman/listinfo/python-list
Re: caught in the import web again
Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel da...@davea.name wrote: Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: In a module that might get tangled in a cycle, avoid global code that depends on other modules. Instead of putting such initialization at top level, put inside a function that gets called after all suspect imports are completed. (That function has global keywords ). If the problem is that one of those modules would import the current module, then after all suspect imports are completed basically means after the current module has finished importing. So what would be responsible for calling such a function? If one builds a set of modules that cannot avoid recursive imports, then one can ask the code that imports it to make a call after importing. Or all that is needed to avoid exposing the mess is that the top level not be part of the loops. This would make the module less reusable though, since the first other module to import it in one program might still be used in another program but not be the first other module to import it. Or I suppose for simplicity it could be required that all importers call the initialization function, and have the function return immediately if it's been called previously. However, I don't think there's any way to do this without ending up with smelly code. The smelly code happened when the designer can't break the cycle. I understood the question to be then what. Two-stage initialization is sometimes needed in any language and I was just showing it's possible in Python. I once worked on (and then fixed) a build system that could not complete a build from clean. It needed some pieces from a previous build in order to get to the point where it was ready to build those pieces. Recursive depencies at compile and link time. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: caught in the import web again
On Wed, Nov 19, 2014 at 6:09 AM, Dave Angel da...@davea.name wrote: I once worked on (and then fixed) a build system that could not complete a build from clean. It needed some pieces from a previous build in order to get to the point where it was ready to build those pieces. Recursive depencies at compile and link time. Sometimes the solution to that is to add intermediate files to the source code archive. Pike can't be built from source control unless you already have a reasonably recent Pike installed, but the exported .tar.gz archive includes all the generated files, so you can build that, then go to the absolute latest from source control. There are always ways around a circular dependency. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: How modules work in Python
On Tuesday, November 18, 2014 12:14:15 AM UTC-8, Larry Hudson wrote: First, I'll repeat everybody else: DON'T TOP POST!!! On 11/16/2014 04:41 PM, Abdul Abdul wrote: Dave, Thanks for your nice explanation. For your answer on one of my questions: *Modules don't have methods. open is an ordinary function in the module.* Isn't method and function used interchangeably? In other words, aren't they the same thing? Or, Python has some naming conventions here? You've already received answers to this, but a short example might clarify the difference: #--- Code # Define a function def func1(): print('This is function func1()') # Define a class with a method class Examp: def func2(self): print('This is method func2()') # Try them out obj = Examp() # Create an object (an instance of class Examp) func1()# Call the function obj.func2()# Call the method through the object func2()# Try to call the method directly -- Error! #--- /Code This code results in the following: This is function func1() This is method func2() Traceback (most recent call last): File fun-meth.py, line 14, in module func2() NameError: name 'func2' is not defined -=- Larry -=- You COULD have something like this though: # --- myModule.py --- def myFunc(): print 'myFunc' # --- main.py --- import myModule myModule.myFunc() In this case, myFunc LOOKS like a method when it is called from main.py, but it is still a function. -- https://mail.python.org/mailman/listinfo/python-list
How do you download and install HTML5TreeBuilder ?
Dear Programmers, I have installed the HTMLParserTreebuilder and LXMLTreeBuilder downloads to my Python2.7 console, using the Windows Console 'pip install' procedure. I downloaded HTML5 files and installed them to my Python2.7 directory, and went through the 'pip install' procedure, but this did not work. I do not know whether it is because different procedure must be followed for HTML5, or that I downloaded the wrong files, the files I downloaded and attempted to install were the following three :- html5lib-0.999(1).tar.gz html5lib-0.999.tar.gz HTMLParser-0.0.2.tar.gz The Windows 7.0 Console returned the following in response :- Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmp4pxazz C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmp81fbka C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmphaw01m C:\Users\Intel Atom I suppose my main conundrum is from where can I download a version of the HTML5 Treebuilder that will install using pip. It doesn't help that HTML5 also happens to be the name of some video editing software. Thank you for reading. PS: If anyone is upset about 'one line paragraphs' and other such petulancies, then please decline to respond, seeing as far as I'm concerned such trivialities are besides the point, and are of no help, so vent your ire elsewhere. YOurs Simon Evans. -- https://mail.python.org/mailman/listinfo/python-list
Re: How do you download and install HTML5TreeBuilder ?
In bbeeb470-aff9-4634-be0a-f9534b0ed...@googlegroups.com Simon Evans musicalhack...@yahoo.co.uk writes: I downloaded HTML5 files and installed them to my Python2.7 directory, and went through the 'pip install' procedure, but this did not work. html5lib-0.999(1).tar.gz html5lib-0.999.tar.gz HTMLParser-0.0.2.tar.gz Those first two files seem identical. Did you mean to download the same file twice? Where did you place the files? You say you 'installed' them to your Python2.7 directory. Is 'C:\Users\Intel Atom' your Python2.7 directory? The command transcript appears to be you typing the same command, 'pip install HTML5', three times, with exactly the same result each time. Did you mean to execute the same command three times over? If so, did you expect to get different results the second or third time? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: How do you download and install HTML5TreeBuilder ?
On 18/11/2014 21:55, Simon Evans wrote: Dear Programmers, I have installed the HTMLParserTreebuilder and LXMLTreeBuilder downloads to my Python2.7 console, using the Windows Console 'pip install' procedure. I downloaded HTML5 files and installed them to my Python2.7 directory, and went through the 'pip install' procedure, but this did not work. I do not know whether it is because different procedure must be followed for HTML5, or that I downloaded the wrong files, the files I downloaded and attempted to install were the following three :- html5lib-0.999(1).tar.gz html5lib-0.999.tar.gz HTMLParser-0.0.2.tar.gz The Windows 7.0 Console returned the following in response :- Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmp4pxazz C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmp81fbka C:\Users\Intel Atompip install HTML5 Downloading/unpacking HTML5 Could not find any downloads that satisfy the requirement HTML5 Cleaning up... No distributions at all found for HTML5 Storing debug log for failure in c:\users\intela~1\appdata\local\temp\tmphaw01m C:\Users\Intel Atom I suppose my main conundrum is from where can I download a version of the HTML5 Treebuilder that will install using pip. It doesn't help that HTML5 also happens to be the name of some video editing software. Thank you for reading. PS: If anyone is upset about 'one line paragraphs' and other such petulancies, then please decline to respond, seeing as far as I'm concerned such trivialities are besides the point, and are of no help, so vent your ire elsewhere. YOurs Simon Evans. I never download files, I just leave the work to pip. I'm assuming this is what you're looking for. c:\Users\Mark\Cash\Pythonpip install html5lib Downloading/unpacking html5lib Running setup.py (path:C:\Users\Mark\AppData\Local\Temp\pip_build_Mark\html5lib\setup.py) egg_info for package html5lib Requirement already satisfied (use --upgrade to upgrade): six in c:\python34\lib\site-packages (from html5lib) Installing collected packages: html5lib Running setup.py install for html5lib Successfully installed html5lib Cleaning up... -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: How to fix those errors?
Roy Smith wrote: In article 54694389$0$13001$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris Angelico wrote: You should be able to use two semicolons, that's equivalent to one colon right? ChrisA (No, it isn't, so don't take this advice. Thanks.) Oooh! Python-ideas territory! I think the parser should allow two consecutive semi-colons, or four commas, as an alias for a colon. Then we could write code like: def spam(arg);; for x in seq pass Wouldn't it make more sense to use four periods? def spam(arg) for x in seq pass First, 2 colons is 4 dots, so it's conservation of punctuation. Second, it reads pretty well. Four periods is already legal, it is ellipsis followed by dot: py __class__ class 'ellipsis' (Try it in Python 3, it actually works!) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: caught in the import web again
Chris Angelico ros...@gmail.com Wrote in message: On Wed, Nov 19, 2014 at 6:09 AM, Dave Angel da...@davea.name wrote: I once worked on (and then fixed) a build system that could not complete a build from clean. It needed some pieces from a previous build in order to get to the point where it was ready to build those pieces. Recursive depencies at compile and link time. Sometimes the solution to that is to add intermediate files to the source code archive. Pike can't be built from source control unless you already have a reasonably recent Pike installed, but the exported .tar.gz archive includes all the generated files, so you can build that, then go to the absolute latest from source control. There are always ways around a circular dependency. Exactly. In the case I was talking about there was a somewhat related problem. The build broke every time, and the fixups were very manual. Nobody even knew if the results depended on the order of applying the fixups. The build lady spent about two days each week fixing stuff up. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: How do you download and install HTML5TreeBuilder ?
re: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Intel Atompip install html5lib Downloading/unpacking html5lib Running setup.py (path:c:\users\intela~1\appdata\local\temp\pip_build_Intel At om\html5lib\setup.py) egg_info for package html5lib Downloading/unpacking six (from html5lib) Downloading six-1.8.0-py2.py3-none-any.whl Installing collected packages: html5lib, six Running setup.py install for html5lib Successfully installed html5lib six Cleaning up... C:\Users\Intel Atom - Thanks Mark. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to access Qt components loaded from file?
On Wed, Nov 19, 2014 at 5:15 AM, Juan Christian juan0christ...@gmail.com wrote: Thanks, it's working. What would be a professional approach if I want to constantly call a URL to get it's content and access this data within the GUI? Constantly doesn't make much sense when you're talking about network operations. There are two basic approaches: either you re-fetch periodically and update the GUI (in which case you have to decide how frequently), or you re-fetch on some trigger (when it's changed, or when the user's about to need it, or something). Either way, you have to balance network traffic versus promptness of update, and it's nearly impossible to pick perfectly. But if you don't mind it being a little clunky, you should be able to pick something fairly simple and deploy it, and then maybe refine it a bit afterward. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
scipy shape
I came across an example that starts as follows: from scipy.ndimage import filters img = zeros(im.shape) What does the second line mean here? Is it setting the image pixels to zero? What is shape here? Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: scipy shape
On 2014-11-19 02:30, Abdul Abdul wrote: I came across an example that starts as follows: from scipy.ndimage import filters img = zeros(im.shape) What does the second line mean here? Is it setting the image pixels to zero? What is shape here? It looks like it might be using numpy. If 'im' is a numpy array representing an image, then its .shape attribute is giving its 'shape' (a tuple of the sizes of its dimensions). numpy.zeros(...) will when return a numpy array of the same shape. So, it's not setting the image pixels to 0, but creating a new image of the same shape in which the pixels are 0. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to fix those errors?
On 17/11/2014 1:06 PM, Chris Angelico wrote: You could then name it in Hebrew: Paamayim Nekudotayim. There is excellent precedent for this - it's done by a language in whose footsteps Python strives to follow. The first time I got a T_PAAMAYIM_NEKUDOTAYIM error, I just about flipped my desk in rage. -- https://mail.python.org/mailman/listinfo/python-list
Re: Trouble getting full response content from PATCH request
On 17Nov2014 20:26, John Gordon gor...@panix.com wrote: I'm working with a third-party API and I'm seeing some behavior that I can't explain. The API uses the HTTP PATCH operation to set user passwords, and in case of unacceptable passwords, the response is supposed to be an HTML document containing a diagnostic message in the body tag. When I submit my test data via a functional testing tool (SoapUI), it behaves as expected. However, when I submit test data from Python code, the response content consists only of the diagnostic message, with no enclosing html or body tags. [...] You need a SOAPAction: HTTP header with SOAP requests. It may be that simple. Cheers, Cameron Simpson c...@zip.com.au Glendower: I can call monsters from the vasty deeps. Hotspur: Why, so can I, or so can any man. But will they come when you do call them? - Henry IV, part 1 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to fix those errors?
On Wed, Nov 19, 2014 at 2:02 PM, alex23 wuwe...@gmail.com wrote: On 17/11/2014 1:06 PM, Chris Angelico wrote: You could then name it in Hebrew: Paamayim Nekudotayim. There is excellent precedent for this - it's done by a language in whose footsteps Python strives to follow. The first time I got a T_PAAMAYIM_NEKUDOTAYIM error, I just about flipped my desk in rage. If that were Hebrew for scope resolution operator, would it be less rage-inducing? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re:scipy shape
Abdul Abdul abdul.s...@gmail.com Wrote in message: I came across an example that starts as follows: from scipy.ndimage import filters img = zeros(im.shape) What does the second line mean here? Is it setting the image pixels to zero? What is shape here? This example is incomplete. Neither zeros nor im are defined in the python versions I have installed, and shape is an attribute of im, whatever type that is. Your example needs at least another import, probably like from numpy import zeros http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html But I can't guess what im might be, unless it's some numpy instance. The other thing missing from the example is the python version. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: How modules work in Python
On 11/18/2014 12:59 PM, sohcahto...@gmail.com wrote: On Tuesday, November 18, 2014 12:14:15 AM UTC-8, Larry Hudson wrote: First, I'll repeat everybody else: DON'T TOP POST!!! On 11/16/2014 04:41 PM, Abdul Abdul wrote: Dave, Thanks for your nice explanation. For your answer on one of my questions: *Modules don't have methods. open is an ordinary function in the module.* Isn't method and function used interchangeably? In other words, aren't they the same thing? Or, Python has some naming conventions here? You've already received answers to this, but a short example might clarify the difference: #--- Code # Define a function def func1(): print('This is function func1()') # Define a class with a method class Examp: def func2(self): print('This is method func2()') # Try them out obj = Examp() # Create an object (an instance of class Examp) func1()# Call the function obj.func2()# Call the method through the object func2()# Try to call the method directly -- Error! #--- /Code This code results in the following: This is function func1() This is method func2() Traceback (most recent call last): File fun-meth.py, line 14, in module func2() NameError: name 'func2' is not defined -=- Larry -=- You COULD have something like this though: # --- myModule.py --- def myFunc(): print 'myFunc' # --- main.py --- import myModule myModule.myFunc() In this case, myFunc LOOKS like a method when it is called from main.py, but it is still a function. My purpose was to give a _simple_ example of the difference in the two terms: that a function is called directly and a method is called through an object. Your example may _look_ the same (it uses the same dot syntax), but here it is to resolve a namespace -- a module is not an object. So yes, this is still a function and not a method. But we're getting rather pedantic here. -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
[issue22095] Use of set_tunnel with default port results in incorrect post value in host header
Serhiy Storchaka added the comment: If call _get_hostport() in set_tunnel() then it should be removed in _tunnel(). As for tests, it would be better do not rely on implementation details. Instead you can monkey-patch the send() method of of HTTPConnection instance and check passed argument. -- nosy: +nikratio, orsenthil, serhiy.storchaka stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22095 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22891] code removal from urllib.parse.urlsplit()
Alexander Todorov added the comment: Does test cases pass after removal of those lines? (I will be surprised) Yes they do. Also see my detailed explanation above, there's no reason for test cases to fail. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22891 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22314] pydoc.py: TypeError with a $LINES defined to anything
Serhiy Storchaka added the comment: Here is a patch. -- keywords: +patch nosy: +serhiy.storchaka stage: - patch review type: - behavior versions: +Python 3.4, Python 3.5 Added file: http://bugs.python.org/file37219/pydoc_ttypager_lines.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22314 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22367 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - pitrou nosy: +pitrou, serhiy.storchaka type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Serhiy Storchaka added the comment: Thank you for your report Chris. PyObject_REPR() is used only in Python/compile.c just before calling Py_FatalError(). So refcount leaks doesn't matter in these cases. PyObject_REPR() is expanded to deprecated _PyUnicode_AsString which is not defined if Py_LIMITED_API is defined. So it is unlikely that third-party code uses it. We can just remove this macro in 3.5. There are other bugs in formatting fatal error messages where PyObject_REPR() is used. PyBytes_AS_STRING() is called for unicode objects. Definitely this branch of the code is rarely executed. Here is a patch which expands PyObject_REPR() in Python/compile.c and replaces PyBytes_AS_STRING() with PyUnicode_AsUTF8(). In 3.5 we also should remove the PyObject_REPR macro definition. -- assignee: - serhiy.storchaka keywords: +patch nosy: +serhiy.storchaka stage: - patch review type: behavior - resource usage versions: -Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file37220/PyObject_REPR.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22652] Add suggestion about keyword arguments to this error message: builtins.TypeError: my_func() takes 1 positional argument but 2 were given
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22652 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22895] regression introduced by the fix for issue #22462
New submission from Matthias Klose: the fix for issue #22462 introduces a regression in the test_pyexpat test cases. I'm not yet sure why. This is only seen when running the testsuite from the installed location, which shouldn't matter. Tried to run the tests with a stripped executable in the build tree worked too, so I'm lost why this now fails. Confirmed that reverting the fix resolves running the testcase in the same environment. -- components: Library (Lib) messages: 231312 nosy: doko, pitrou priority: high severity: normal status: open title: regression introduced by the fix for issue #22462 versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22895 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
STINNER Victor added the comment: PyObject_REPR() is expanded to deprecated _PyUnicode_AsString which is not defined if Py_LIMITED_API is defined. PyObject_REPR() is still defined if Py_LIMITED_API is defined, I just checked. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Serhiy Storchaka added the comment: PyObject_REPR() is still defined if Py_LIMITED_API is defined, I just checked. But it is expanded to undefined name. So it is not usable in any case. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
STINNER Victor added the comment: PyObject_REPR.patch: the first part looks good to me. For the second part, you can use PySys_FormatStderr() which is more complex but more correct: it formats the string as Unicode and then encode it to stderr encoding. PyUnicode_FromFormatV() is probably safer to handle errors. You may use PySys_FormatStderr() in the two functions to write context, and then call Py_FatalError with a simple message. The exact formatting doesn't matter much, these cases must never occur :-) An assertion may be enough :-p -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
STINNER Victor added the comment: Serhiy Storchaka wrote: But it is expanded to undefined name. So it is not usable in any case. Ah correct, I didn't notice _PyUnicode_AsString in the expanded result (I checked with gcc -E). When Py_LIMITED_API is set, PyObject_REPR(o) is expanded to _PyUnicode_AsString(PyObject_Repr(o)). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22895] regression introduced by the fix for issue #22462
Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com: -- nosy: +jkloth ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22895 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22462] Modules/pyexpat.c violates PEP 384
Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com: -- nosy: +jkloth ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22462 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22895] regression introduced by the fix for issue #22462
Antoine Pitrou added the comment: Please post the traceback. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22895 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
Antoine Pitrou added the comment: This sounds reasonable, indeed. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22367 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Antoine Pitrou added the comment: PyObject_REPR() is expanded to deprecated _PyUnicode_AsString which is not defined if Py_LIMITED_API is defined. So it is unlikely that third-party code uses it Py_LIMITED_API is the stable ABI. Most third-party code doesn't use it, so it may still use PyObject_REPR(). -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22895] regression introduced by the fix for issue #22462
Matthias Klose added the comment: [258/383] test_pyexpat test test_pyexpat failed -- Traceback (most recent call last): File /usr/lib/python3.4/test/test_pyexpat.py, line 432, in test_exception parser.Parse(babc//b/a, 1) File ../Modules/pyexpat.c, line 405, in StartElement File /usr/lib/python3.4/test/test_pyexpat.py, line 422, in StartElementHandler raise RuntimeError(name) RuntimeError: a During handling of the above exception, another exception occurred: Traceback (most recent call last): File /usr/lib/python3.4/test/test_pyexpat.py, line 447, in test_exception self.assertIn('call_with_frame(StartElement', entries[1][3]) File /usr/lib/python3.4/unittest/case.py, line 1053, in assertIn if member not in container: TypeError: argument of type 'NoneType' is not iterable test_exception (test.test_pyexpat.HandlerExceptionTest) ... ERROR == ERROR: test_exception (test.test_pyexpat.HandlerExceptionTest) -- Traceback (most recent call last): File /usr/lib/python3.4/test/test_pyexpat.py, line 432, in test_exception parser.Parse(babc//b/a, 1) File ../Modules/pyexpat.c, line 405, in StartElement File /usr/lib/python3.4/test/test_pyexpat.py, line 422, in StartElementHandler raise RuntimeError(name) RuntimeError: a During handling of the above exception, another exception occurred: Traceback (most recent call last): File /usr/lib/python3.4/test/test_pyexpat.py, line 447, in test_exception self.assertIn('call_with_frame(StartElement', entries[1][3]) File /usr/lib/python3.4/unittest/case.py, line 1053, in assertIn if member not in container: TypeError: argument of type 'NoneType' is not iterable -- Ran 36 tests in 0.016s -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22895 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22113] memoryview and struct.pack_into
Serhiy Storchaka added the comment: This issue is similar to issue10212. Here is a patch which makes struct.pack_into() support new buffer protocol. Something similar should be applied to 3.x because PyObject_AsWriteBuffer() is deprecated and not safe. -- assignee: - serhiy.storchaka nosy: +kristjan.jonsson, pitrou, serhiy.storchaka, terry.reedy stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22895] test failure introduced by the fix for issue #22462
Antoine Pitrou added the comment: Thanks. So, this is not a regression: the failing test was introduced in #22462 and probably would have not worked before, either. The problem is that ../Modules/pyexpat.c makes sense from the checkout directory but not necessarily from the install location. I don't know if we should try to be smarter or not. At first we could make the test more lenient. -- components: +Tests priority: high - normal title: regression introduced by the fix for issue #22462 - test failure introduced by the fix for issue #22462 type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22895 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22896] Don't use PyObject_As*Buffer() functions
New submission from Serhiy Storchaka: PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and PyObject_AsWriteBuffer() release the buffer right after acquiring and return a pointer to released buffer. This is not safe and could cause issues sooner or later. These functions shouldn't be used in the stdlib at all. -- assignee: serhiy.storchaka components: Extension Modules, Interpreter Core messages: 231323 nosy: serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Don't use PyObject_As*Buffer() functions type: resource usage versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22896 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22608] test_socket fails with sem_init: Too many open files
Serhiy Storchaka added the comment: I suggest to merge issue22608 and issue22610 and also clean up other long living event objects in tests. -- nosy: +serhiy.storchaka stage: - needs patch versions: +Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22608 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10599] sgmllib.parse_endtag() is not respecting quoted text
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Library (Lib) -None nosy: +ezio.melotti versions: +Python 2.7 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10599 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18637] mingw: export _PyNode_SizeOf as PyAPI for parser module
Serhiy Storchaka added the comment: LGTM. -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka stage: - commit review type: enhancement - behavior versions: +Python 2.7, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18637 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18637] mingw: export _PyNode_SizeOf as PyAPI for parser module
Roundup Robot added the comment: New changeset eb25629d2a46 by Serhiy Storchaka in branch '2.7': Issue #18637: Fixed an error in _PyNode_SizeOf declaration. https://hg.python.org/cpython/rev/eb25629d2a46 New changeset ab3e8aab7119 by Serhiy Storchaka in branch '3.4': Issue #18637: Fixed an error in _PyNode_SizeOf declaration. https://hg.python.org/cpython/rev/ab3e8aab7119 New changeset 0f663e0ce1d3 by Serhiy Storchaka in branch 'default': Issue #18637: Fixed an error in _PyNode_SizeOf declaration. https://hg.python.org/cpython/rev/0f663e0ce1d3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18637 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18637] mingw: export _PyNode_SizeOf as PyAPI for parser module
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18637 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18637] mingw: export _PyNode_SizeOf as PyAPI for parser module
Serhiy Storchaka added the comment: Definitely this was a bug. Thank you Roumen for your patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18637 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Serhiy Storchaka added the comment: For the second part, you can use PySys_FormatStderr() which is more complex but more correct PySys_FormatStderr() is more heavy function, it depends on working sys.stderr and codecs. Taking into account the lack of tests we should be careful with such changes. So I prefer to keep fprintf. Py_LIMITED_API is the stable ABI. Most third-party code doesn't use it, so it may still use PyObject_REPR(). So we should just add a warning? This macro is not documented anywhere. -/* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj)) +#ifndef Py_LIMITED_API +/* Helper for passing objects to printf and the like. + Leaks refcounts. Don't use it! +*/ +#define PyObject_REPR(obj) PyUnicode_AsUTF8(PyObject_Repr(obj)) +#endif -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19670] SimpleCookie Generates Non-RFC6265-Compliant Cookies
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19670 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Antoine Pitrou added the comment: Le 18/11/2014 17:39, Serhiy Storchaka a écrit : Py_LIMITED_API is the stable ABI. Most third-party code doesn't use it, so it may still use PyObject_REPR(). So we should just add a warning? This macro is not documented anywhere. Well we can still remove it, and add a porting note in whatsnew for 3.5. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17750] allow the testsuite to run in the installed location
Changes by Matthias Klose d...@debian.org: -- dependencies: +test failure introduced by the fix for issue #22462 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21266] test_zipfile fails to run in the installed location
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21266 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21032] Socket leak if HTTPConnection.getresponse() fails
Serhiy Storchaka added the comment: Could you please submit a contributor form (https://www.python.org/psf/contrib/) Martin? -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka stage: - patch review versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21032 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20948] -Wformat=2 -Wformat-security findings
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +haypo, pitrou, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20948 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20082] Misbehavior of BufferedRandom.write with raw file in append mode
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach stage: - patch review versions: +Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20082 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20066] PyStructSequence_NewType() not setting proper heap allocation flag?
Serhiy Storchaka added the comment: See also issue15729. -- components: +Interpreter Core nosy: +serhiy.storchaka stage: - needs patch versions: +Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20066 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15729] PyStructSequence_NewType enhancement
Serhiy Storchaka added the comment: See also issue20066. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21266] test_zipfile fails to run in the installed location
Serhiy Storchaka added the comment: This is a duplicate of issue17753 (test_write_filtered_python_package was added later). -- resolution: - duplicate stage: - resolved status: open - closed superseder: - test_zipfile: requires write access to test and email.test ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21266 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22825] Modernize TextFile
Serhiy Storchaka added the comment: So you suggest just close this issue? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22825 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Serhiy Storchaka added the comment: Here is updated patch. -- Added file: http://bugs.python.org/file37221/PyObject_REPR_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___diff -r 0f663e0ce1d3 Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst Tue Nov 18 17:30:50 2014 +0200 +++ b/Doc/whatsnew/3.5.rst Tue Nov 18 19:14:09 2014 +0200 @@ -441,3 +441,7 @@ Changes in the C API * The :c:type:`PyMemAllocator` structure was renamed to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added. + +* Removed non-documented macro :c:macro:`PyObject_REPR` which leaked references. + Use format character ``%R`` in :c:func:`PyUnicode_FromFormat`-like functions + to format the :func:`repr` of the object. diff -r 0f663e0ce1d3 Include/object.h --- a/Include/object.h Tue Nov 18 17:30:50 2014 +0200 +++ b/Include/object.h Tue Nov 18 19:14:09 2014 +0200 @@ -575,9 +575,6 @@ PyAPI_FUNC(PyObject *) PyObject_Dir(PyOb PyAPI_FUNC(int) Py_ReprEnter(PyObject *); PyAPI_FUNC(void) Py_ReprLeave(PyObject *); -/* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj)) - /* Flag bits for printing: */ #define Py_PRINT_RAW1 /* No string quotes etc. */ diff -r 0f663e0ce1d3 Python/compile.c --- a/Python/compile.c Tue Nov 18 17:30:50 2014 +0200 +++ b/Python/compile.c Tue Nov 18 19:14:09 2014 +0200 @@ -1414,12 +1414,12 @@ get_ref_type(struct compiler *c, PyObjec PyOS_snprintf(buf, sizeof(buf), unknown scope for %.100s in %.100s(%s)\n symbols: %s\nlocals: %s\nglobals: %s, - PyBytes_AS_STRING(name), - PyBytes_AS_STRING(c-u-u_name), - PyObject_REPR(c-u-u_ste-ste_id), - PyObject_REPR(c-u-u_ste-ste_symbols), - PyObject_REPR(c-u-u_varnames), - PyObject_REPR(c-u-u_names) + PyUnicode_AsUTF8(name), + PyUnicode_AsUTF8(c-u-u_name), + PyUnicode_AsUTF8(PyObject_Repr(c-u-u_ste-ste_id)), + PyUnicode_AsUTF8(PyObject_Repr(c-u-u_ste-ste_symbols)), + PyUnicode_AsUTF8(PyObject_Repr(c-u-u_varnames)), + PyUnicode_AsUTF8(PyObject_Repr(c-u-u_names)) ); Py_FatalError(buf); } @@ -1476,11 +1476,11 @@ compiler_make_closure(struct compiler *c fprintf(stderr, lookup %s in %s %d %d\n freevars of %s: %s\n, -PyObject_REPR(name), -PyBytes_AS_STRING(c-u-u_name), +PyUnicode_AsUTF8(PyObject_Repr(name)), +PyUnicode_AsUTF8(c-u-u_name), reftype, arg, -_PyUnicode_AsString(co-co_name), -PyObject_REPR(co-co_freevars)); +PyUnicode_AsUTF8(co-co_name), +PyUnicode_AsUTF8(PyObject_Repr(co-co_freevars))); Py_FatalError(compiler_make_closure()); } ADDOP_I(c, LOAD_CLOSURE, arg); ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22113] memoryview and struct.pack_into
Antoine Pitrou added the comment: I think you forgot to upload your patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22113] memoryview and struct.pack_into
Serhiy Storchaka added the comment: Oh, sorry. Here is it. -- keywords: +patch Added file: http://bugs.python.org/file37222/struct_pack_into_memoryview.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22113 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22897] IDLE - MacOS: freeze on non-ASCII save with open debugger
New submission from Boris: When attempting to save a file containing an Aring; character with the debugger open, IDLE freezes with/or without partially opening the warning window. (Mac OS X 10.9.5, IDLE running python 2.7.5). Reproducible steps: - Create and save file with one line: 1+1 # A - Open IDLE - Open the debugger - Open the file - Delete the A, type shiftaltA - type commands to save. This triggers the problem. Application hangs (not responding) and needs to force quit. Sometimes the graphics memory of other applications gets corrupted. -- components: IDLE messages: 231338 nosy: steipe priority: normal severity: normal status: open title: IDLE - MacOS: freeze on non-ASCII save with open debugger type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22897 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21280] shutil.make_archive() with default root_dir parameter raises FileNotFoundError: [Errno 2] No such file or directory: ''
Serhiy Storchaka added the comment: Here is a patch. -- assignee: - serhiy.storchaka keywords: +patch nosy: +hynek, serhiy.storchaka, tarek stage: - patch review type: - behavior versions: +Python 3.5 Added file: http://bugs.python.org/file37223/shutil_make_archive_in_curdir.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21280 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20156] bz2.BZ2File.read() does not treat growing input file properly
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka priority: normal - low versions: +Python 3.5 -Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20156 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'
Changes by Serhiy Storchaka storch...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21775 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'
Serhiy Storchaka added the comment: LGTM. Go ahead Greg. -- assignee: - gward nosy: +serhiy.storchaka stage: - commit review versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21775 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20948] -Wformat=2 -Wformat-security findings
Roundup Robot added the comment: New changeset d6d2549340cb by Victor Stinner in branch 'default': Issue #20948: Inline makefmt() in unicode_fromformat_arg() https://hg.python.org/cpython/rev/d6d2549340cb -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20948 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21775] shutil.copytree() crashes copying to VFAT on Linux: AttributeError: 'PermissionError' object has no attribute 'winerror'
STINNER Victor added the comment: Would it be possible to write a unit test, maybe using unittest.mock to mock most parts? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21775 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20948] -Wformat=2 -Wformat-security findings
STINNER Victor added the comment: The format parameter passed to sprintf() is created by makefmt() function. In Python 3.5, makefmt() has a few parameters. The code is simple and looks safe. The makefmt() function was much more complex in Python 3.3, it had more parameters: zeropad, width and precision. I refactored PyUnicode_FromFormatV() to optimize it. During the optimization, makefmt() was simplified, and in fact it is now possible to inline it and remove it. I just removed it in Python 3.5. Should we change something in Python 2.7 and 3.4? Ignore the warning? Or can I just close the issue? Thanks for the report Jeffrey. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20948 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
STINNER Victor added the comment: PyObject_REPR_2.patch looks good to me, but it should only be applied to Python 3.5. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22898] segfault during shutdown attempting to log ResourceWarning
New submission from A. Jesse Jiryu Davis: Running a unittest suite for Motor, my MongoDB driver which uses PyMongo, greenlet, and Tornado. The suite commonly segfaults during interpreter shutdown. I've reproduced this crash with Python 3.3.5, 3.4.1, and 3.4.2. Python 2.6 and 2.7 do *not* crash. The Python interpreters are all built like: ./configure --prefix=/mnt/jenkins/languages/python/rX.Y.Z --enable-shared make make install This is Amazon Linux AMI release 2014.09. The unittest suite's final output is: -- Ran 15 tests in 265.947s OK Segmentation fault (core dumped) Backtrace from a Python 3.4.2 coredump attached. -- components: Interpreter Core files: dump.txt messages: 231345 nosy: emptysquare priority: normal severity: normal status: open title: segfault during shutdown attempting to log ResourceWarning type: crash versions: Python 3.4 Added file: http://bugs.python.org/file37224/dump.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22898 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Roundup Robot added the comment: New changeset e339d75a21d5 by Serhiy Storchaka in branch 'default': Issue #22453: Removed non-documented macro PyObject_REPR(). https://hg.python.org/cpython/rev/e339d75a21d5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22898] segfault during shutdown attempting to log ResourceWarning
A. Jesse Jiryu Davis added the comment: The crash can ignore whether or not I specify -Wignore on the python command line. I was hoping to avoid the crash by short-circuiting the ResourceWarning code path, since the following line appears in the backtrace: #5 PyErr_WarnFormat (category=optimized out, stack_level=stack_level@entry=1, format=format@entry=0x7f5f1ca8b377 unclosed file %R) at Python/_warnings.c:813 But -Wignore has no effect. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22898 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Roundup Robot added the comment: New changeset 342a619cdafb by Serhiy Storchaka in branch '3.4': Issue #22453: Warn against the use of leaking macro PyObject_REPR(). https://hg.python.org/cpython/rev/342a619cdafb New changeset 6e26b5291c41 by Serhiy Storchaka in branch '2.7': Issue #22453: Fexed reference leaks when format error messages in ceval.c. https://hg.python.org/cpython/rev/6e26b5291c41 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22894] unittest.TestCase.subTest causes all subsequent tests to be skipped in failfast mode
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22894 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22453] PyObject_REPR macro causes refcount leak
Serhiy Storchaka added the comment: Thank you for your reviews Victor and Antoine. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22899] http.server.BaseHTTPRequestHandler.parse_request (TypeError: decoding str is not supported)
New submission from Ryan Chartier: While the parse_request is handling the requestline, it tries to force the string into iso-8859-1 using an unsupported syntax. Line #274 in server.py requestline = str(self.raw_requestline, 'iso-8859-1') Obviously, python complains. TypeError: decoding str is not supported I'm running python 3.4.2 and the line is present in the 3.4.2 source I downloaded from the python.org today. That is all. -- messages: 231350 nosy: recharti priority: normal severity: normal status: open title: http.server.BaseHTTPRequestHandler.parse_request (TypeError: decoding str is not supported) type: crash versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22899 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22899] http.server.BaseHTTPRequestHandler.parse_request (TypeError: decoding str is not supported)
Georg Brandl added the comment: With the vanilla BaseHTTPRequestHandler, this shouldn't happen. self.raw_requestline is read from a socket file, which returns bytes, so they can be decoded using str(bytes, encoding). Can you please check if there are any third-party packages involved that call/subclass the classes from http.server and introduce a bytes/str confusion? They might not be correctly/completely ported to Python 3 in that case. In any case, a full traceback will be helpful to help debug this. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22899 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22370] pathlib OS detection
Roundup Robot added the comment: New changeset cb1d7eac601d by Antoine Pitrou in branch '3.4': Close #22370: Windows detection in pathlib is now more robust. https://hg.python.org/cpython/rev/cb1d7eac601d New changeset 712f246da49b by Antoine Pitrou in branch 'default': Close #22370: Windows detection in pathlib is now more robust. https://hg.python.org/cpython/rev/712f246da49b -- nosy: +python-dev resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22370 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22897] IDLE hangs on OS X with Cocoa Tk if encoding dialog is required during save
Ned Deily added the comment: Thanks for the report. It appears that all that is needed to trigger the hang is any operation that invokes the IDLE EncodingMessage dialog (Non-ASCII found, yet no encoding declared. Add a line like [...]) in IOBinding.py during a Save when IDLE is linked with the OS X Cocoa Tk 8.5 (or likely 8.6) as used with the python.org 64-bin/32-bit 10.6+ installers, for example, just opening a new edit window, inserting a non-ASCII character, and then trying to Save. EncodingMessage subclasses the Tkinter SimpleDialog module and creates a new Toplevel root; I seem to recall other problems like this in the past. The problem is not seen with the older Carbon Tk 8.4 or with an X11 Tk on OS X. -- nosy: +ned.deily stage: - needs patch title: IDLE - MacOS: freeze on non-ASCII save with open debugger - IDLE hangs on OS X with Cocoa Tk if encoding dialog is required during save ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22897 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22867] document behavior of calling atexit.register() while atexit._run_exitfuncs is running
Ethan Furman added the comment: From a post by Ian Kelly (https://mail.python.org/pipermail/python-list/2014-November/681073.html) -- In fact it seems the behavior does differ between Python 2.7 and Python 3.4: $ cat testatexit.py import atexit @atexit.register def main(): atexit.register(goodbye) @atexit.register def goodbye(): print(Goodbye) $ python2 testatexit.py Goodbye Goodbye $ python3 testatexit.py Goodbye -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22867 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22825] Modernize TextFile
Éric Araujo added the comment: Yes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22825 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18905] pydoc -p 0 says the server is available at localhost:0
Serhiy Storchaka added the comment: With the patch resolved address 127.0.0.1 is printed instead of localhost. self.address[0] can be used to match current behavior of 2.7 and 3.x. And why not just initialize the url attribute in server_activate()? -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka stage: - patch review Added file: http://bugs.python.org/file37225/pydoc_port_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18905 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18731] Increased test coverage for uu and telnet
Serhiy Storchaka added the comment: test_encode_defaults is failed now. Don't use hardcoded filename length. And I don't understand the purpose of changes in uu.py. -- versions: +Python 2.7, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22825] Modernize TextFile
Serhiy Storchaka added the comment: Thank you for your response. This was a part of large patch about migration to use of with (issue22826 and issue22831 are other parts). -- resolution: - rejected stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22825 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com