[issue44564] DeprecationWarning in test_enum over formatting
Change by Brandon Schabell : -- keywords: +patch nosy: +brandonschabell nosy_count: 2.0 -> 3.0 pull_requests: +25638 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27090 ___ Python tracker <https://bugs.python.org/issue44564> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44159] mimetypes - "strict" on Windows
Change by Brandon Schabell : -- keywords: +patch nosy: +brandonschabell nosy_count: 5.0 -> 6.0 pull_requests: +25636 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27088 ___ Python tracker <https://bugs.python.org/issue44159> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38820] Make Python compatible with OpenSSL 3.0.0
Change by Brandon Weeks : -- nosy: +bweeks ___ Python tracker <https://bugs.python.org/issue38820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42316] Walrus Operator in list index
New submission from Brandon : Reading the PEP 572 document I don't see anything stating that Walrus operator in list indexes must be enclosed in parenthesis. Minimal Example: ''' In [1]: a = list(range(10)) In [2]: idx = -1 In [3]: a[idx := idx +1] File "", line 1 a[idx := idx +1] ^ SyntaxError: invalid syntax ''' If you enclose in parenthesis it works as expected: ''' In [4]: a[(idx := idx +1)] Out[4]: 0 In [5]: a[(idx := idx +1)] Out[5]: 1 In [6]: a[(idx := idx +1)] Out[6]: 2 ''' Is this a bug or am I misreading the PEP 572 document somewhere? It's not a top-level assignment nor is it a list comprehension so I would expect it to work in the first example. -- components: asyncio messages: 380691 nosy: Brando753, asvetlov, yselivanov priority: normal severity: normal status: open title: Walrus Operator in list index versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue42316> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40332] RegEx for numbers in documentation (easy fix - solution provided)
New submission from Brandon : The regular expression used for matching numbers in the documentation for the regular expressions module (the tokenizer section) doesn't match the string ".5", but does match the string "3.". Here's a link to the tokenizer section of the documentation: https://docs.python.org/3/library/re.html#writing-a-tokenizer The tokenizer example uses r'\d+(\.\d*)?' for matching numbers. I would personally match ".5" as a number before I would match "3." as a number. In order to do this, I would use r'(\d*\.)?\d+' instead of r'\d+(\.\d*)?'. Python 3's interpreter matches both "3." and ".5" as numbers when interpreting code, so you could use a different regex example for matching both if you wanted to be consistent with Python's own interpreter. -- components: Regular Expressions messages: 366801 nosy: TheBrandonGuy, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: RegEx for numbers in documentation (easy fix - solution provided) type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40332> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39068] Base 85 encoding initialization race condition
Change by Brandon Stansbury : -- title: Base 85 encoding initialization race conditiong -> Base 85 encoding initialization race condition ___ Python tracker <https://bugs.python.org/issue39068> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39068] Base 85 encoding initialization race conditiong
New submission from Brandon Stansbury : Under multi-threading scenarios a race condition may occur where a thread sees an initialized `_b85chars` table but an uninitialized `_b85chars2` table due to the guard only checking the first table. This causes an exception like: ``` File "/usr/lib/python3.6/base64.py", line 434, in b85encode return _85encode(b, _b85chars, _b85chars2, pad), File "/usr/lib/python3.6/base64.py", line 294, in _85encode for word in words], File "/usr/lib/python3.6/base64.py", line 294, in for word in words], "TypeError: 'NoneType' object is not subscriptable ``` -- components: Library (Lib) messages: 358495 nosy: drmonkeysee priority: normal pull_requests: 17096 severity: normal status: open title: Base 85 encoding initialization race conditiong type: crash versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue39068> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37749] ipaddress - is_global method all multicast addresses and networks return true
Change by Brandon James : -- keywords: +patch pull_requests: +14833 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15088 ___ Python tracker <https://bugs.python.org/issue37749> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37749] ipaddress - is_global method all multicast addresses and networks return true
New submission from Brandon James : When using the ipaddress library, all multicast addresses and networks return True when using the is_global method for their respective classes. I believe their are two possible fixes for this. 1) In practice no multicast addresses are globally routable. If our definition of is_global means the address is globally routable, then I propose adding not is_multicast to each class's is_global logic. 2) RFC 5771 (IPv4) and RFCs 4291 and 7346 (IPv6) both have guidelines for what MAY be routed on the public internet (as mentioned above multicast is not routed globally in practice). Logic following those guidelines should be added. IPv4: 224.0.1.0/24, AD-HOC I, II and III addresses 224.0.2.0 - 224.0.255.255, 224.3.0.0 - 224.4.255.255, and 233.252.0.0 - 233.255.255.255 IPv6: Multicast addresses with 0xE in the SCOPE field The current logic is inaccurate when looking at the relevant RFCs and worse when looking at how routing is actually implemented. Github PR submitted for option 1 above. I've also submitted a thread to NANOG's mailing list (currently pending moderator approval) posing a few questions regarding the RFCs above. I think it's unlikely that multicast will ever be publicly routed on the internet, so really we just need to define global here. My definition would be addresses that are routed on the public internet. -- components: Library (Lib) messages: 348942 nosy: bjames priority: normal severity: normal status: open title: ipaddress - is_global method all multicast addresses and networks return true ___ Python tracker <https://bugs.python.org/issue37749> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22343] Install bash activate script on Windows when using venv
Brandon VanVaerenbergh - NOAA Affiliate added the comment: +1 just experienced this issue migrating from Python3.4 to Python3.5 on windows with bash (MINGW git bash) as primary shell Temporarily resolved issue (on this workstation) by simply copying Python35\Lib\venv\scripts\posix\activate file, into folder: Python35\Lib\venv\scripts\nt\ then recreating venv -- nosy: +Brandon VanVaerenbergh - NOAA Affiliate versions: +Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22343> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26780] Illustrate both binary operator conventions in PEP-8
Changes by Brandon Rhodes <bran...@rhodesmill.org>: -- type: -> enhancement ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26780] Illustrate both binary operator conventions in PEP-8
Brandon Rhodes added the comment: Another important objection against the current text is that it stacks a series of `and` and `or` operators at the same level of indentation, as though they naturally evaluate in the order the programmer writes them. In fact, they have different levels of precedence, and the code example violates the other sections of PEP-8 that ask for the creation of a visual distinction in code between different precedence levels. The example needs to pivot towards a series of operators which belong at the same precedence level. I have used `+` and `-` because they seemed more natural to form an example from than something like division and multiplication. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26780] Illustrate both binary operator conventions in PEP-8
Changes by Brandon Rhodes <bran...@rhodesmill.org>: Added file: http://bugs.python.org/file42489/pep8-knuth.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26780] Illustrate both binary operator conventions in PEP-8
Changes by Brandon Rhodes <bran...@rhodesmill.org>: Removed file: http://bugs.python.org/file42487/pep8-knuth.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26780] Illustrate both binary operator conventions in PEP-8
New submission from Brandon Rhodes: I am delighted to see that PEP-8 has pivoted to breaking long formulae before, rather than after, each binary operator! But I would like to pivot the PEP away from citing my own PyCon Canada talk as the authority on the matter, and toward citing Knuth himself. It would also be an enhancement for the PEP to show both options and make an argument for the practice, instead of simply asserting that one is better than the other. I therefore propose the attached patch. -- assignee: docs@python components: Documentation files: pep8-knuth.patch keywords: patch messages: 263554 nosy: barry, brandon-rhodes, docs@python, gvanrossum priority: normal severity: normal status: open title: Illustrate both binary operator conventions in PEP-8 Added file: http://bugs.python.org/file42487/pep8-knuth.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: I've tested the new patch and it is still able to properly find both chrome and firefox and is able to differentiate between new window and new tab for those two browsers so it is still working. Would someone review the patch? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8232> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25884] inspect.getmro() fails when base class lacks __bases__ attribute.
Brandon Zerbe added the comment: I am using Python 2.7.5. The segment of code from inspect that I previously extracted came from line 332 although you may also find it by "finding" _searchbases. This is really an issue with Forthon: http://hifweb.lbl.gov/Forthon/ Specifically the Forthon class, which I think is older than current standards. If you guys want this Forthon class to flag an error (I can work around that too), than the proposed fix I sent can be rejected, and this ticket can be closed. I just wanted to bring this case to you attention just in case. Thanks again, Brandon Quoting "R. David Murray" <rep...@bugs.python.org>: > > R. David Murray added the comment: > > Which version of python are you running? I can't match that > traceback up to the code in the current 2.7 inspect module. > > That said, the same issue probably exists in the current code. A 2.7 > class is expected to have either an __mro__ or a __bases__ attribute, > and if it has neither inspect probably *should* throw an error, since > it can't know what to do with the class. The error could be clearer, > though. > > But, let's see what others think. > > -- > nosy: +r.david.murray > > ___ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue25884> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25884> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25884] inspect.getmro() fails when base class lacks __bases__ attribute.
New submission from Brandon Zerbe: I am using a possibly non-standard python package called Forthon, and when I inspect an object that is dependent on the Forthon class, I get the following error: File "/Users/zerbeb/homemade_programs/config2class/src/method_parsing.py", line 18, in get_all_init_args inherited_classes = inspect.getmro(class_obj) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 346, in getmro if hasattr(cls, "__bases__"): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 337, in _searchbases for base in cls.__bases__: AttributeError: 'Forthon' object has no attribute '__bases__' This was easy enough to fix, simply add "if not hasattr(cls,'__bases__'): return" to the _searchbases function: def _searchbases(cls, accum): # Simulate the "classic class" search order. if cls in accum: return if not hasattr(cls, "__bases__"): #Additional code. return accum.append(cls) for base in cls.__bases__: _searchbases(base, accum) Maybe you have a better solution, but I think this edge case can be trivially solved however you decide to edit the code. Thanks! -- messages: 256525 nosy: billyziege priority: normal severity: normal status: open title: inspect.getmro() fails when base class lacks __bases__ attribute. versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25884> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: applying 25005_1.patch patching file Lib/webbrowser.py Hunk #1 FAILED at 498 Hunk #2 FAILED at 524 Hunk #3 FAILED at 532 Hunk #4 FAILED at 540 Hunk #5 FAILED at 548 I'm trying to apply your patch after applying webbrowserfix6.patch but I am encountering problems. I first tried "hg import --no-commit file.patch" for both patches but it wouldn't let me use the command two times in a row without committing the changes for the first one so I tried committing the webbrowserfix6.patch changes and then using the import command and I get this error message. I would like to try to make sure the code still does what it is supposed to but I can't check until I can get both patches in. Hunk #6 FAILED at 556 6 out of 6 hunks FAILED -- saving rejects to file Lib/webbrowser.py.rej patching file Modules/posixmodule.c Hunk #1 FAILED at 10522 Hunk #2 FAILED at 10578 Hunk #3 FAILED at 10590 Hunk #4 FAILED at 10606 Hunk #5 FAILED at 10616 5 out of 5 hunks FAILED -- saving rejects to file Modules/posixmodule.c.rej abort: patch failed to apply -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8232> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: Ok I've been able to test the new patch now and I'm not sure that os.startfile is going to work. I've been able to get os.startfile() to open a specified browser (>>> os.startfile("chrome.exe", "open")), however, the function does not allow additional arguments(>>> os.startfile("chrome.exe", "open", "www.yahoo.com") Traceback (most recent call last): File "", line 1, in TypeError: startfile() takes at most 2 arguments (3 given))) so not even a url will be allowed to be specified as the code is written in the patch let alone specifying new window or new tab. Is this an error on os.startfile's part? The documentation for it seems to indicate that it should take multiple inputs. I don't have much experience with C to be able to find out figure out what the rest of your patch accomplished. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8232> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: Finally got it rebuilt after having trouble with visual studio for awhile. I've tested the new patch and it is still able to properly find both chrome and firefox and is able to differentiate between new window and new tab for those two browsers so it appears to still be working. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8232> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24452] Make webbrowser support Chrome on Mac OS X
Brandon Milam added the comment: Boštjan Mejak the windows issue has been addressed in issue 8232 and recently patched for 3.5. http://bugs.python.org/issue8232 -- nosy: +jbmilam ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24452 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: Moved the 64 bit browser list to its own loop and switched to browsers.append rather than +=. -- Added file: http://bugs.python.org/file39650/webbrowserfix6.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: Here's a patch addressing all of the comments in the review. Changing the browsers from a set to a list though resulted in duplicates in the _tryorder list that were not present before because the set had filtered the duplicates before the partial string comparisons. The _browsers dictionary did not contain the duplicates so I don't think this will have any functional changes. -- Added file: http://bugs.python.org/file39626/webbrowserfix5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24148] 'cum' not a valid sort key for pstats.Stats.sort_stats
Brandon Milam added the comment: They are correct. 'cum' is not one of the available keywords and so here is the fix changing it to say 'cumulative' for consistency as ramiro suggested. -- keywords: +patch nosy: +jbmilam Added file: http://bugs.python.org/file39627/profile_example_fix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24148 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: Forgive me the excessive number of patch submissions as I am still getting my feet wet in contributing to Python. I'm posting another patch that is not functionally different from the last patch but should better adhere to the PEP8 style guide. Please let me know of any additional changes that need to be made or if a different functionality is preferred. -- Added file: http://bugs.python.org/file39590/webbrowserfix4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12020] Attribute error with flush on stdout,stderr
Brandon Milam added the comment: I've been looking over the issue and the error is just raised by the stdout change not the stderr change (when the stdout line is commented out in the setAutoFlush function no error is raised). The flush method doesn't seem to be required as Serhiy pointed out since the script still is able to run. This is the cause for the error, however and I think that the required subset of methods for stdout objects to avoid errors could be clarified in the documentation. This documentation addition I think would be best under the sys.stdout info rather than under io.TextIOBase since the error can be raised without going through this class at all like in the original post. I would like to add this documentation under sys.stdout as required subset of methods that must be defined and was wondering if there were any other methods than flush() that would need to be defined. -- nosy: +jbmilam ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12020 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21297] csv.skipinitialspace only skips spaces, not whitespace in general
Changes by Brandon Milam jmilam...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file39560/csv_skipinitialspace_docfix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21297 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21297] csv.skipinitialspace only skips spaces, not whitespace in general
Changes by Brandon Milam jmilam...@gmail.com: Added file: http://bugs.python.org/file39559/csv_skipinitialspace_testing.csv ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21297 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21297] csv.skipinitialspace only skips spaces, not whitespace in general
Brandon Milam added the comment: This code shows what Daniel Andersson was talking about. I changed the whitespace references in the documentation that Daniel mentioned to say spaces. Also I changed ignore space at the start of the field to ignore spaces at the start of the field due to Terry's confusion. Let me know of any errors or extra changes that are needed. -- nosy: +jbmilam Added file: http://bugs.python.org/file39558/csv_skipinitialspace_testing.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21297 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24147] Dialect class defaults are not documented.
Brandon Milam added the comment: Here I added on to the Dialects and Formatting Parameters paragraph explaining that the defaults listed are for the excel dialect and that all the attributes need to be specified if the user is wanting to create custom dialects through sub-classing. I will also include the html file this produces for those who do not want to look at the .rst file. Also I can go in and change the defaults of the Dialect class on the parameters that expect Boolean values if desired but I would open a separate issue for it. Let me know if there are any errors or desired changes in document change. -- keywords: +patch Added file: http://bugs.python.org/file39552/csv_dialect_doc_clarify.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24147 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24147] Dialect class defaults are not documented.
Changes by Brandon Milam jmilam...@gmail.com: Added file: http://bugs.python.org/file39553/csv.html ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24147 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23659] csv.register_dialect doc string
Brandon Milam added the comment: I believe this was the requested change. Let me know if more was desired. -- keywords: +patch nosy: +jbmilam Added file: http://bugs.python.org/file39540/register_dialect_docstring_fix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23659 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23659] csv.register_dialect doc string
Brandon Milam added the comment: Sorry, I forgot an end parentheses in the doc string of the last patch. -- Added file: http://bugs.python.org/file39541/register_dialect_docstring_fix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23659 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24147] Dialect class defaults are not documented.
Brandon Milam added the comment: Hi all, I've been looking at this bug and am ready to start putting in some work on it but I have some questions about what is wanting to be done. From what I can tell these are the possible tasks for this issue. - Add to the docs under the dialect section the excel attributes vs. the dialect class attributes and explain how the excel dialect is the default and this is the functionality you'd be changing by creating a new dialect. - Add code to make sure that a certain number of attributes are set before the dialect can be accessed. (Though this might be C code and not really a C programmer nor do I know where _Dialect is in the repository) - Change the defaults in the dialects class because currently the documentation for double quote and skip initial space says that the default is False when in the code it is None. Also I did not find the strict dialect in the module at all. (maybe its part of that C code that I don't know how to find. - Add an example to the documentation on sub-classing dialect under the example on registering a new dialect If someone could clarify which of these is the desired direction for this issue it would be much appreciated. -- nosy: +jbmilam ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24147 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: I went ahead and took the assert statement out and added support for vista using a union of sets for both the 32 bit and 64 bit locations. -- Added file: http://bugs.python.org/file39533/webbrowserfix3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: On second thought no type testing is required if sets are used because the union will take out duplicates anyways and so I removed the type testing and left in the set union code. -- Added file: http://bugs.python.org/file39534/webbrowserfix3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: I kept the changes to the WindowsDefault.open() method and used and extended eryksun's code to build the browser list using the registry. Also I added support for a few more browsers. Some of the browsers I could not find ways to differentiate between opening a new window or new tab using command line flags. This also removed the hardcoding I had put in the get function. -- Added file: http://bugs.python.org/file39525/webbrowserfix2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: I got rid of the __init__ for the WindowsDefault class that I asked about earlier and changed it to match the sub-classing model that the Unix browsers use. This caused some changes in the get function too. Due to the _isexecutable still not completely working, the get function is hard coded for chrome, internet explorer and firefox for windows systems. This is my first attempt at making a patch file so if it is incorrect please bear with me. -- keywords: +patch Added file: http://bugs.python.org/file36265/webbrowserfix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: In order to fix the issue I added on to the WindowsDefault class so that it is the main browser class for windows platforms as opposed to being a default when no other browser is given. I gave the class an init where it specifies specific flags for firefox, chrome, and internet explorer (from what I could find there aren't really new window or new tab flags for internet explorer). If the flags for other browsers are known they should be easy to add to this section. def __init__(self,browser = windows-default): # Grab the different flags for the different browser types browser.lower() self.browsername = browser # If get() is used without arguments browser will be passed None if browser == windows_default or browser == None: self.cmd = start elif browser == 'iexplore' or browser == 'internet explorer': self.cmd = start iexplore self.newwindow = self.newtab = elif browser == chrome: self.cmd = start chrome.exe self.newwindow = -new-window self.newtab = -new-tab elif browser == firefox: self.cmd = start firefox.exe self.newwindow = -new-window self.newtab = -new-tab else: raise Error('The browser you entered (%s) is not currently supported on windows' % browser) In the open method of the WindowsDefault class I changed how the browser is opened by building a command from the flags and the cmd for the specific browser and used subprocess,call. # Format the command for optional arguments and add the url if new == 1: self.cmd += + self.newwindow elif new == 2: self.cmd += + self.newtab self.cmd += + url subprocess.call(self.cmd,shell = True) This allows the user to input different new arguments to open a new window or new tab like the documentation says they should be able to do. I added a little bit to the beginning of the get function so that it passes its argument to the WindowsDefault class and returns that object on Windows systems. # Let the windows default class handle different browsers on windows if sys.platform[:3] == win: return WindowsDefault(using) This adds some of the desired compatibility but does not completely address the module's issues. I did not see a way to open a web page in a currently open page on any of the browsers, just new windows and new tabs (when no flags are passed the browsers default to one of these two options). Also the _isexecutable function's attempt at windows compatibility is still not working because I was unsure of how to use just a string of a browser name like 'chrome' to determine if a file is on a system. This leaves _tryorder not properly containing the browsers on the system. This leaves the module's open, open_new and open_new_tab not properly working either just the WindowsDefault open method. Any feed back and direction from here is most welcome. -- nosy: +jbmilam Added file: http://bugs.python.org/file36110/webbrowserdebug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: How the _isexecutable function is set up now it would require a full path name in order to be able to tell if a specific browser is on the system. The area under platform support for windows checks for multiple browsers using this function but only passes it browser names and so it always returns false and does not add any browsers to _tryorder. I found a way to fix this using os.walk so that the simple strings of the browser names like firefox.exe is able to actually able to be found on the system. This method is rather slow though and the module wants to check for 8 browsers when imported. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21956] Doc files deleted from repo are not deleted from docs.python.org.
Brandon Rhodes added the comment: Now that I am back at a full keyboard, I see that my previous response to @BreamoreBoy about this issue is too short and too cryptic to really serve as a fair answer to his question. And, with some embarrassment, I note that my words did not even achieve the dignity of forming an actual English sentence. Alas for cramped travel laptop keyboards and airport wi-fi! Might I be allowed another try? If so, then: @BreamoreBoy, I think that your confusion (How does that translate?) can be blamed squarely on the document in question. Instead of introducing and maintaining a consistent terminology, it manages to burden the reader with two parallel and redundant sets of terms for exactly the same idea. In short, the document title does not match the document itself. The title of the document sets forth the terms Idiom and Anti-idiom as its subject. But then it completely drops the ball. The terms are not defined in the document itself. They are not clarified anywhere in its text. Nor are they even *used* anywhere in its body, with a single lonely exception buried down somewhere around the middle (second paragraph under Exceptions). Instead, the body uses the simpler phrases Do, do not, and should not. It is running in its do not / don't mode when it reaches the sentence you quote, Mark, about from...import statements. So the answer to your How does that translate question is that what the title promises as Idioms and Anti-idioms actually come out verbally in the text as do and don't instead. When someone jumps into the middle of the document without context, they see only do or don't and are left wondering where the terminology of idioms is even coming from. But it comes directly from the title, as the only possible mapping between the document's terms and those of its title. So when the document says: from module import name1, name2. - This is a don’t... the careful reader who has noticed and remembered the title will simultaneously read: from module import name1, name2. - This is an anti-idiom... Which is almost exactly the text of Audrey's tweet. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21956] Deleted document should not appear in 3.4 docs
New submission from Brandon Rhodes: There was an old document in the howto folder whose advice was in many cases flat-out wrong, so Raymond Hettinger performed a wonderful public service by deleting it back in 2011: http://hg.python.org/cpython/rev/80ff78425419 Unfortunately it looks like the process for publishing Python documentation only adds documents, but never deletes them, so a copy of the documentation is still available under the 3.4 document tree: https://docs.python.org/3.4/howto/doanddont.html It should be deleted as soon as possible. Because it is presumed that only the most accurate and up-to-date documentation lives under the URL 3.4, people are reading and debating this document's bad advice as though it is official guidance as to how to use the language. (The only hint that something is wrong, alas, is the tiny detail that the top-left of the page says “Python v3.3a0 documentation”). The advice is currently being debated on Twitter and people are sad that they are supposed to stop using “from foo import bar” in Python. -- messages: 222741 nosy: brandon-rhodes priority: normal severity: normal status: open title: Deleted document should not appear in 3.4 docs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21956] Deleted document should not appear in 3.4 docs
Changes by Brandon Rhodes bran...@rhodesmill.org: -- assignee: - docs@python components: +Documentation nosy: +docs@python versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21956] Deleted document should not appear in 3.4 docs
Brandon Rhodes added the comment: The question of whether the document ought to be removed is not at issue here. The document was already deleted, in 2011, by Raymond Hettinger, with the consent of its author. I told that story merely as background. The issue here is that the Python web site is out of date with the documentation in the Mercurial source repository, which is clear because what is clearly marked as an old 3.3-alpha document is being served out of the /3.4/ directory. This is probably because the documentation “push” script does not remove documents from the site, and can be corrected through a simple rm by anyone with access to the server. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21956] Doc files deleted from repo are not deleted from docs.python.org.
Brandon Rhodes added the comment: I do not find it unreasonable, on a page of Python idioms, the we would call an example that explicitly says Don't in its title an anti-idiom. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21570] String being confused with datetime.datetime object.
New submission from Brandon: Observe the following code: import MySQLdb, MySQLdb.cursors, datetime ... mysqlCursor is a cursor object from a connection to database from the MySQLdb module ... mysqlCursor.execute(SELECT NOW()) timeRow = mysqlCursor.fetchall() currentDateTime = datetime.datetime.strptime(timeRow[0][NOW()], %Y-%m-%d %H:%M:%S) I get the following error: TypeError: must be string, not datetime.datetime HOWEVER, when I cast timeRow[0][NOW()] to a string like: str(timeRow[0][NOW()]) , it works fine. For whatever reason the Python interpreter seems to interpret the string from the row of the MySQLdb cursor result as a datetime.datetime object. I have no explanation for this, besides it looking like a date time in the format of -mm-dd HH:MM:SS. I have not tried this in Python 3.x, but the bug is in the latest compile of version 2.7.6 from the FTP distribution site. -- components: Interpreter Core messages: 219041 nosy: brandon priority: normal severity: normal status: open title: String being confused with datetime.datetime object. type: compile error versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21570] String being confused with datetime.datetime object.
Brandon added the comment: Type returned as datetime, I was not familiar with the MySQLdb code. Sorry for the bad report. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21570] String being confused with datetime.datetime object.
Changes by Brandon x...@codeslum.org: -- resolution: - not a bug ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21083] Add get_content_disposition() to email.message.Message
New submission from Brandon Rhodes: Content-Disposition is an optional header field. In its absence, the MUA may use whatever presentation method it deems suitable. — RFC 2183 The email.message.Message class should gain a get_content_disposition() method with the three possible return values 'inline', 'attachment', and None so that email clients can easily distinguish between the three states described in the RFC. See also the discussion at http://bugs.python.org/issue21079 -- components: email messages: 215036 nosy: barry, brandon-rhodes, r.david.murray priority: normal severity: normal status: open title: Add get_content_disposition() to email.message.Message type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21083 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: Thanks — done! http://bugs.python.org/issue21083 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21091] EmailMessage.is_attachment should be a method
New submission from Brandon Rhodes: I love properties and think they should be everywhere. But consistency is more important, so I suspect that EmailMessage.is_attachment should be demoted to a normal method. Why? Because if it remains a property then I am likely to first write: if msg.is_attachment: ... and then later, when doing another bit of email logic, write: if msg.is_multipart: ... Unfortunately this second piece of code will give me no error and will appear to run just fine, because bool(a_method) always returns True without a problem or warning or error. But the result will not be what I expect: the if statement's true block will always run, regardless of whether the message is multipart. Since EmailMessage is still provisional, and since no one can use is_attachment yet anyway because it is broken for nearly all attachments, mightn't we make these two features consistent before calling it official? -- components: email messages: 215104 nosy: barry, brandon-rhodes, r.david.murray priority: normal severity: normal status: open title: EmailMessage.is_attachment should be a method versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21091 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21095] EmailMessage should support Header objects
New submission from Brandon Rhodes: Currently, the new wonderful EmailMessage class ignores the encoding specified in any Header objects that are provided to it. import email.message, email.header m = email.message.Message() m['Subject'] = email.header.Header('Böðvarr'.encode('latin-1'), 'latin-1') print(m.as_string()) Subject: =?iso-8859-1?q?B=F6=F0varr?= m = email.message.EmailMessage() m['Subject'] = email.header.Header('Böðvarr'.encode('latin-1'), 'latin-1') print(m.as_string()) Traceback (most recent call last): ... TypeError: 'Header' object does not support indexing If the EmailMessage came to recognize and support Header objects, then Python programmers under specific constraints regarding what encodings their customers' email clients will recognize and support would be able to hand-craft the selection of the correct encoding instead of being forced to either ASCII or UTF-8 with binary as the two predominant choices that EmailMessage makes on its own. -- components: email messages: 215112 nosy: barry, brandon-rhodes, r.david.murray priority: normal severity: normal status: open title: EmailMessage should support Header objects versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21095 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21075] fileinput should use stdin.buffer for rb mode
New submission from Brandon Rhodes: In Python 3, fileinput.input() returns str lines whether the data is coming from stdin or from a list of files on the command line. But if input(mode='rb') is specified, then its behavior becomes inconsistent: lines from stdin are delivered as already-decoded strings, but data from files is delivered (correctly) as bytes. The solution may be that, if a b is anywhere in the mode, then input() should read from the bytes stdin.buffer data source instead of from stdin. Otherwise the rb mode is rather useless since you can wind up getting text from it anyway depending on how you are invoked. -- components: Library (Lib) messages: 214952 nosy: brandon-rhodes priority: normal severity: normal status: open title: fileinput should use stdin.buffer for rb mode type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21075 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
New submission from Brandon Rhodes: Most attachments (in my inbox, at least) specify a filename, and thus have a Content-Disposition header that looks like: Content-Disposition: attachment; filename=attachment.gz In fact, this sample header was generated by the new add_attachment() method in Python itself. Unfortunately, the is_attachment property currently does this test: c_d.lower() == 'attachment' Which means that it returns False for almost all attachments in my email archive. I believe that the test should instead be: c_d.split(';', 1)[0].lower() == 'attachment' -- components: email messages: 214969 nosy: barry, brandon-rhodes, r.david.murray priority: normal severity: normal status: open title: EmailMessage.is_attachment == False if filename is present versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: Oh - this also, happily, explains why iter_attachments() is ignoring all of the attachments on my email: because it internally relies upon is_attachment to make the decision. So this fix will also make iter_attachments() usable! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: Okay, having looked at the source a bit more it would probably make more sense to use _splitparam() instead of doing the split manually. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: Given that methods like get_param() already exist for pulling data out of the right-hand-side of the ';' in a parameterized email header, would it be amiss for EmailMessage to also have a method that either returns everything to the left of the semicolon, or returns something like: ('attachment', [('filename', 'example.txt')]) thus doing all the parsing in one place that everything else can then steadily rely upon, including users that want to pull the parsed values for their own inspection? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: Understood. I wonder where in the documentation the ability to get the content disposition should wind up? I am almost tempted to suggest a get_content_disposition() method that parallels get_content_type(), mostly to avoid having to document the asymmetry between how users should go about getting these two pieces of information. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21079] EmailMessage.is_attachment == False if filename is present
Brandon Rhodes added the comment: I agree that is_attachment supports the most common use-case of people who need to inspect the content disposition! But people implementing heavyweight tools and email clients might additionally need to distinguish between a MIME part whose disposition is explicitly inline and a MIME part whose disposition is simply unspecified — since the RFC seems to allow clients quite a bit of freedom in the case where it is entirely unspecified: Content-Disposition is an optional header field. In its absence, the MUA may use whatever presentation method it deems suitable. — RFC 2183 And a three-possibility 'inline'|'attachment'|None return value from get_content_disposition() would perfectly reflect the three possibilities envisioned in the standard. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19536] MatchObject should offer __getitem__()
New submission from Brandon Rhodes: Regular expression re.MatchObject objects are sequences. They contain at least one “group” string, possibly more, which are integer-indexed starting at zero. Today, groups can be accessed in one of two ways. (1) You can call the method match.group(N). (2) You can call glist = match.groups() and then access each group as glist[N-1]. Note the obvious off-by-one error: .groups() does not include “group zero”, which contains the entire match, and therefore its indexes are off-by-one from the values you would pass to .group(). I propose that MatchObject gain a __getitem__(N) method whose return value for every N is the same as .group(N) as I think that match[N] is a quite obvious syntax for asking for one particular group of an RE match. The only objection I can see to this proposal is the obvious asymmetry between Group Zero and all subsequent groups of a regular expression pattern: zero means “the whole thing” whereas each of the others holds the content of a particular explicit set of parens. Looping over the elements match[0], match[1], ... of a pattern like this: r'(\d\d\d\d)/(\d\d)/(\d\d)' will give you *first* the *entire* match, and only then turn its attention to the three parenthesized substrings. My retort is that concentric groups can happen anyway: that Group Zero, holding the entire match, is not really as special as the newcomer might suspect, because you can always wind up with groups inside of other groups; it is simply part of the semantics of regular expressions that groups might overlap or might contain one another, as in: r'((\d\d)/(\d\d)) Description: (.*)' Here, we see that concentricity is not a special property of Group Zero, but in fact something that can happen quite naturally with other groups. The caller simply needs to imagine every regular expression being surrounded by an “automatic set of parentheses” to understand where Group Zero comes from, and how it will be ordered in the resulting sequence of groups relative to the subordinate groups within the string. If one or two people voice agreement here in this issue, I will be very happy to offer a patch. -- components: Regular Expressions messages: 202480 nosy: brandon-rhodes, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: MatchObject should offer __getitem__() type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19536 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19536] MatchObject should offer __getitem__()
Changes by Brandon Rhodes bran...@rhodesmill.org: -- versions: +Python 3.4 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19536 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be specified from memory rather than files.
Brandon Craig Rhodes added the comment: Kristján, you are certainly correct that a single-argument that can be either a filename or a cert is inappropriate; we should not be peeking inside of strings to guess what they contain. And I think you also have a good point about Pythonic-ness when it comes to polymorphism; routines that are sensitive to object type have been going more and more out of style for the past twenty years, and for good reason. But, having ceded those points, I still think string-or-file-like-object is the correct approach here, simply because it is the overwhelming approach of the Standard Library; everyone is used to it, and will already know the ropes of that approach; and it prevents noisying up the interface with redundant arguments. Were we doing this over again, we would simply not allow a filename at all, and let the user open the file if they needed to. But since a filename is allowed, it feels like the Official Standard Library Approach to also allow a file-like object. Some examples: zipfile.ZipFile: Open a ZIP file, where file can be either a path to a file (a string) or a file-like object. http://docs.python.org/2/library/zipfile#zipfile.ZipFile binhex.hexbin: Decode a binhex file input. input may be a filename or a file-like object supporting read() and close() methods. http://docs.python.org/release/2.7.5/library/binhex.html#binhex.hexbin xml.dom.minidom.parse: filename_or_file may be either a file name, or a file-like object. http://docs.python.org/2/library/xml.dom.minidom.html#xml.dom.minidom.parse mailbox.Mailbox.add: Parameter message may be a Message instance, an email.message.Message instance, a string, or a file-like object (which should be open in text mode). http://docs.python.org/2/library/mailbox.html#mailbox.Mailbox.add pickletools.dis: pickle can be a string or a file-like object. http://docs.python.org/2/library/pickletools.html#pickletools.dis I suggest that these precedents, along with others that I believe we could find with a more exhaustive search of the Standard Library, are sufficient to suggest that in this case the least-surprise approach is a single argument that's either a filename or file-like object. I would suggest reviewing quickly the code for the above examples and following their example for how to distinguish most cleanly between a filename and file-like object; I wonder if they call any common code to get the contents out, or each do it completely by themselves? :) Thanks again for wanting to add this to the SSL module, it will be a *great* addition that solves an important use case! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be specified from memory rather than files.
Brandon Craig Rhodes added the comment: Kristján, your patch is a wonderful idea—I am about to commit production code that will have to create tens of thousands of temporary files during operation, one file each time SSL is started up on a socket, which could be avoided if something like this patch were applied. I had always assumed that it was simply a limitation of the underlying SSL library! An interface that takes a filename like this, instead of a live file-like object, seems so un-Pythonic that I assumed the only reason for it was a limitation in OpenSSL. Thank you very much for looking under the covers and discovering that this was not the case! I do, though, feel a slight twinge when we add Even More Parameters to a Standard Library routine but in such a way that it cannot be used with an existing parameter — as here in your patch, where we gain a parameter like `certdata` that cannot be (should not be?) used at the same time as `certfile`. It seems redundant to have two names for the same parameter to the underlying library, and makes it look like the routine needs more information than it really does. Since my own instinct was to think, ten minutes ago, Maybe I can pass a StringIO, since it says it wants a fine!, I am very much in support of the idea of keeping only the existing parameters, but making them accept both strings (which, for compatibility, would continue to be interpreted as filenames) and file-like objects as arguments. I think this would have a great deal of symmetry with how other parts of the Standard Library work, while keeping this patch's central value of making it possible for those of us with cert-heavy code to avoid the creation of thousands of files a minute. Again, thank you VERY much for discovering that OpenSSL can do this, and I will try to provide whatever encouragement I can as you try to shepherd this past the other committers. -- nosy: +brandon-rhodes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17855] Implement introspection of logger hierarchy
Brandon Craig Rhodes added the comment: Adding an entirely separate API for introspection strikes me as counter-productive — instead of merely having to maintain the logging API that you already maintain, you will additionally now have an entirely separate and second API that also has to be maintained forever. Reading back over the current logging documentation, it looks like the problem is that the documentation only includes verbs — the methods that can be invoked — but not adjectives: the attributes that are attached to each logger, handler, and filter. This is contrary to modern Python APIs, which typically document their attributes and offer direct access to them; within the Standard Library, cf the threading.Thread object for one that has done a good job of moving into the modern world with directly-accessible attributes. So my guess would be that you should discard the idea of a separate introspection API, and simply document that attributes of each logger, handler, and filter that today are already perfectly introspectable. Check out the logging_tree code if you want to make sure that you are “promoting” into document-hood all of the attributes that I needed in order to do my introspecting there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17855 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13477] tarfile module should have a command line
Brandon Craig Rhodes added the comment: Larry Hastings rep...@bugs.python.org writes: Huh. tar *can* infer it from the data itself. On the other hand, it chooses explicitly not to. I guess tar knows explicit is better than implicit too ;-) I am told that the refusal of tar to introspect the data is because: (a) Tar runs gunzip -c (for example) as an external program; it does not actually compile against libz. (b) Streams in UNIX cannot be rewound. Tar cannot look at the first block of an input pipe and then put the block back so that the same input can be fed directly to gunzip as its input. (c) Given (a) and (b), tar could only support data introspection of input from a pipe if it were willing to be a pass-through that, after reading and introspecting the first block, then fired up gunzip and sent ALL of the blocks through. Which would require multiprocessing, threading, or async I/O so that tar could both read and write, which would make tar more complicated. (d) Therefore, tar refuses to even look. Since Python does bundle compression in its standard library, it can quite trivially step forward and actually do the data introspection that tar insists on not doing; the first few bytes of a tar archive are quite demonstrably different from the first bytes of a gzip stream, if I recall. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17370] PEP should not if it has been superseded
New submission from Brandon Craig Rhodes: A friend (@theomn on Twitter) was just working off of PEP-333 when I mentioned to him that PEP-, and he had never heard of it, and he expressed the wish that PEPs would have a banner or something at the top if there is a more recent version of them. I think his idea is great, and is like the feature of PyPI where if Google lands you on an old version of a package then it is careful to tell you up at the top that a more recent version is available. This could extend to all sorts of cross-references that we should maintain: some PEPs have been superseded; others have more recent supplements that people should read as well (think of the relationship between packaging PEPs); PEPs that did not wind up being implemented have cousins who were; and so forth. Is this something that needs to wait until the New Python Web Site appears, and that would be meta-markup somehow maintained along with the PEP texts themselves? Or should there be a “Related PEPs” paragraph that we open at the top of each relevant PEP and just include the cross-links as raw updates to the PEP's own restructured text? I'm open to a simple implementation here, so long as we can provide more “community context” when people land on a PEP. -- assignee: docs@python components: Documentation messages: 183625 nosy: brandon-rhodes, docs@python priority: normal severity: normal status: open title: PEP should not if it has been superseded ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17370 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17370] PEP should note if it has been superseded
Brandon Craig Rhodes added the comment: (Corrected not to note in the title and went with enhancement) -- title: PEP should not if it has been superseded - PEP should note if it has been superseded type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17370 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17370] PEP should note if it has been superseded
Brandon Craig Rhodes added the comment: The original inspiration: https://twitter.com/theomn/status/309468740611891200 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17370 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13477] tarfile module should have a command line
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: The tarfile module should have a simple command line that allows it to be executed with -m — even if its only ability was to take a filename and extract it to the current directory, it could be a lifesaver on Windows machines where Python has been installed but nothing else. Would such a patch be welcome if I could write one up? -- messages: 148300 nosy: brandon-rhodes priority: normal severity: normal status: open title: tarfile module should have a command line ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1947] Exception exceptions.AttributeError '_shutdown' in module 'threading'
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: In case Google brings anyone else to this bug: this error typically indicates that a `threading.py` which is not actually the Standard Library's `threading` module has somehow wound up on an earlier path in `sys.path` and is therefore shadowing the Standard Library module. This upsets the Python exit logic, which tries to run `threading._shutdown()` if `threading` exists in `sys.modules`. I just helped someone on Stack Overflow with a situation like this, which in that case resulted from an error in how `pylint` works. -- nosy: +brandon-rhodes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1947 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11561] coverage of Python regrtest cannot see initial import of libs
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Brett, yes, you are welcome to close this issue — Ned quite handily convinced me that coverage code belongs in the coverage distribution, not languishing about in the CPython source tree. That solution also quite beautifully solves the copyright problem. So I happily withdraw my request for this feature. Nick, Brett is working on exactly the sort of devguide improvement that you suggest — not least because the devguide will now need to instruct people in how to build coverage so that its C-accelerated tracer is available, which Ned's own patch to coverage to cover stdlib tracing uses instead of the Python tracer that I cut-and-pasted into this patch. Finally, it would be wonderful to have a more formal mechanism for boot-time interventions. I have mentioned before my wish that Python's first action be to open() the executable, check its tail to see if it's a valid zipfile, and if so to try loading and running startup.py from that zipfile. Among other things, that would allow single-file distribution of pure-Python applications without the py2exe/py2app mess that prevails in the projects I work with today. But since the whole issue of grabbing control at boot time raises hackles (why would you want to do that!?), and I needed something working immediately during the PyCon sprint, I elected to simply adopt encodings.py as my way in. It works great, and coverage can evolve to an even better mechanism as soon as one becomes available, should anyone want to take the bootup option and run with it. One final thought: should PyPy etc also implement the same boot protocol, should one be invented, so that all mainline interpreters can be instrumented the same way? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Ezio and Sandro, thank you very much for your attention to this issue, and for helping me split it into manageable chunks! To answer the question about why coverage does not show as high a total as it ought: it's because coverage normally can't see the outer, global scope execution of modules that are already imported by the time coverage itself can take control and install a tracer. I have another patch outstanding that fixes this — we are still working on it, but the code works fine — if you want to run coverage and see a more accurate number: http://bugs.python.org/issue11561 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Éric, I think your points are good ones. (And, as I return to this patch after three months, I should thank the PSF for sponsoring the CPython sprint here at PyOhio, and creating this opportunity for me to continue trying to land this patch!) I am attaching a fourth version of the patch. It incorporates your two suggestions, Éric. It also applies cleanly once against today's trunk; besides the usual line number changes as code has come and gone, I am happy to see that my change of an assertTrue for an assertIs in the test suite has already taken place thanks to another patch in the meantime. -- Added file: http://bugs.python.org/file22822/test_copy4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11561] coverage of Python regrtest cannot see initial import of libs
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Éric, I think your suggestions are all good ones, and I have incorporated them into the file. (But do note that the departures we are now making from Ned's own copy of the tracer code — removing the commented-out debugging statement, and the long comment, and the inheritance from object — might make it harder to bring in changes from his own copy if he should ever further improve it.) I have tried to write the comments to be more informative, while also addressing your own ideas; let me know if you like the result! Oh: and, I am continuing to use this new file in my own work on the Python core, and it has been working fine — so no problems with the actual code have developed over these first 3+ months of use. -- Added file: http://bugs.python.org/file22823/fullcoverage2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12056] … (HORIZONTAL ELLIPSIS) should be an alternative syntax for ... (FULL STOP FULL STOP FULL STOP)
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: But if we allow for ellipsis, then would we not also have to start allowing characters like ≥ and ≤ in Python? And the problem with any of these (admittedly very attractive) substitutions is that they seem to abandon the principle of there being One Obvious Way of typing any given expression. Instead there would now be several alternate ways, with different styles in different codebases and, I think, something of a visual and symbolic mess resulting. I like each symbol to have exactly one possible representation. -- nosy: +brandon-rhodes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12056 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11848] Comment for random.betavariate is intriguing and incomplete
New submission from Brandon W Maister quodlibe...@gmail.com: The comment just before the random.betavariate method reads in part: ## See ## http://sourceforge.net/bugs/?func=detailbugbug_id=130030group_id=5470 ## for Ivan Frohne's insightful analysis of why the original implementation: ## (snip original implementation) was dead wrong, and how it propbably got that way. And I would like to read that comment, but the buglink is pretty deeply dead. I'm not sure what the correct thing to do here is, maybe stick the text of the bug into the comment, or just update the link. But I'm definitely curious. Thanks. -- components: Demos and Tools messages: 133788 nosy: quodlibetor priority: normal severity: normal status: open title: Comment for random.betavariate is intriguing and incomplete ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11848 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11848] Comment for random.betavariate is intriguing and incomplete
Brandon W Maister quodlibe...@gmail.com added the comment: Oh, awesome, thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11848 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Nick Coghlan rep...@bugs.python.org writes: Regarding __reduce__, other readers will have the same question Éric did, so that point should definitely go in a comment after the __reduce_ex__ check. I just sat down to review this issue, and, looking at test_copy3.patch, isn't there already a comment next to each __reduce_ex__ check that reminds the reader that object.__reduce_ex__ will itself call __reduce__? Does the comment just need to be more elaborate or something? Finally, Éric wants me to replace this: self.assertTrue(issubclass(copy.Error, Exception)) with self.assertIsInstance(). But surely the question is not whether copy.Error is an *instance* of Exception? They are both instances of *type*, right? What I would need is something like assertIsSubclass or assertInheritsFrom, neither of which exists. So I think that test_copy3.patch already includes all of the valid improvements on the table; if I'm missing one, just point it out and I'll fix it! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Nick Coghlan rep...@bugs.python.org writes: Nick Coghlan ncogh...@gmail.com added the comment: Regarding __reduce__, other readers will have the same question Éric did, so that point should definitely go in a comment after the __reduce_ex__ check. I had initially wanted to make a comment, but feared the objection that a comment would eventually fall out of sync with the implementation of object.__reduce_ex__ over the years (just as copy.py currently has all sorts of cruft that is no longer applicable). But I think that you are right that a comment that's at least true today is better than no comment at all; so I will add one on Monday. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Éric, after checking line 112 of the two patches and then of the new file, I figured out that you meant line 112 of the old file — and, yes, that test can go away too since in python3 complex always exists and unicode never exists. A further improved patch (#3) is attached. -- Added file: http://bugs.python.org/file21276/test_copy3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Éric, the Makefile in Python trunk seems to include Objects/complexobject.o in the build unilaterally without any way to turn it off. What is leading you to believe that Python 3 can conditionally turn the complex type off during a build? I do not understand your question about Unicode — could you reference the line number in the patch file that is worrying you? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Antoine, neither this issue, nor either version of my patch, was intended to assert that 100% test coverage indicates that a test of tests are complete. If you will point out where in the text this is implied, I will correct it. Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: The attached patch will bring Lib/copy.py to 100% test coverage. A bug in coverage results in its only reporting 99% at the moment; see coverage issue #122 on bitbucket: https://bitbucket.org/ned/coveragepy/issue/122/for-else-always-reports-missing-branch This patch makes several minor improvements to copy: when doing getattr lookups with a default of None, it now uses an is comparison against None which is both faster and more correct; several special cases have been removed since Python 3 always has CodeType available; and an ancient obsolete test suite that had been appended to copy.py in ancient times has been removed. -- files: test_copy.patch keywords: patch messages: 131135 nosy: brandon-rhodes priority: normal severity: normal status: open title: bring Lib/copy.py to 100% coverage versions: Python 3.3 Added file: http://bugs.python.org/file21244/test_copy.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue502085] pickle problems (with Boost.Python)
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Benjamin, I would like some way to know when our tests achieve 100% coverage because otherwise I will keep coming back to this module to add more tests and have to re-discover code that is not CPython relevant. But for now I have removed the pragmas. The attached patch also changes assertIs() and assertIsNot(), and uses self.fail() instead of the exception inside of support. Thanks for those pointers! -- keywords: +patch nosy: +brandon-rhodes Added file: http://bugs.python.org/file21245/test_copy2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue502085 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue502085] pickle problems (with Boost.Python)
Changes by Brandon Craig Rhodes bran...@rhodesmill.org: Removed file: http://bugs.python.org/file21245/test_copy2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue502085 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11572] bring Lib/copy.py to 100% coverage
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Benjamin, thanks for the pointers! The attached patch now uses assertIs() and assertIsNot(), and calls self.fail() instead of using the exception from support. In the future I would like some way to determine when test coverage is fully achieved, so that I do not come back to this module every few months and have to re-discover why it is not 100%. But for the moment I have indeed removed the pragmas, pending a better approach! -- Added file: http://bugs.python.org/file21246/test_copy2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11561] coverage of Python regrtest cannot see initial import of libs
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: When running the Python regression tests in coverage, the initial outer level of interpreted code in several standard library modules shows as not having been covered by the tests, because they were imported during the Python boot process and were already loaded when the coverage command got control. -- messages: 131051 nosy: brandon-rhodes priority: normal severity: normal status: open title: coverage of Python regrtest cannot see initial import of libs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11561] coverage of Python regrtest cannot see initial import of libs
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Here is a module that solves this problem if the tests are run with the fullcoverage directory at the front of the PYTHONPATH, like this: PYTHONPATH=Tools/fullcoverage ./python -m coverage run --pylib Lib/test/regrtest.py test_copy -- keywords: +patch Added file: http://bugs.python.org/file21232/fullcoverage.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10979] setUpClass exception causes explosion with -b
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: Normally, unittest cleanly reports an exception in a setUpClass method. But if I place the attached test in a directory by itself and then run python -m unittest discover -b from inside of the same directory, then instead of being shown the setUpClass exception I am instead shown a long traceback because unittest seems to think that it has put a stringIO in place of sys.stdout but a file is there instead. -- components: Library (Lib) files: test_example.py messages: 126816 nosy: brandon-rhodes priority: normal severity: normal status: open title: setUpClass exception causes explosion with -b type: crash versions: Python 2.7 Added file: http://bugs.python.org/file20484/test_example.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10901] Python 3 MIME generator dies if not given boundary
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: If you try doing msg.as_string() to a MIMEMultipart message that has not been given a boundary, then it dies with this exception: Traceback (most recent call last): File mime_gen_alt.py, line 40, in module print(msg.as_string()) File /home/brandon/python3.2b2/lib/python3.2/email/message.py, line 164, in as_string g.flatten(self, unixfrom=unixfrom) File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 88, in flatten self._write(msg) File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 134, in _write self._dispatch(msg) File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 160, in _dispatch meth(msg) File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 234, in _handle_multipart self.write('--' + boundary + self._NL) TypeError: Can't convert 'NoneType' object to str implicitly -- components: Library (Lib) messages: 126187 nosy: brandon-rhodes priority: normal severity: normal status: open title: Python 3 MIME generator dies if not given boundary type: crash versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10901 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10901] Python 3 MIME generator dies if not given boundary
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Here is a patch that fixes the problem. The problem probably only occurs if the MIMEMultipart is actually given several MIME parts to use in its interior. -- keywords: +patch Added file: http://bugs.python.org/file20391/email-boundary.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10901 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9723] pipes.quote() needs to be documented
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: The only way to safely build shell command lines from inside of Python — which is necessary when sending commands across SSH, since that behaves like os.system() rather than like subprocess.call() — is to use the wonderful pipes.call() method to turn possibly-dangerous arguments, like filenames that might have spaces, special characters, and embedded rm -r calls, into perfectly quoted strings for an sh-like shell (say, bash or zsh). This call is already recommended on mailing lists, blog posts, and Stack Overflow — and since it doesn't start with a _, I think its public use is fair game. But the pipes documentation itself doesn't officially mention or support it. I think it should be added to the Standard Library documentation for pipes. So. Yeah. -- assignee: d...@python components: Documentation messages: 115263 nosy: brandon-rhodes, d...@python priority: normal severity: normal status: open title: pipes.quote() needs to be documented type: feature request versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8713] multiprocessing needs option to eschew fork() under Linux
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: The multiprocessing module uses a bare fork() to create child processes under Linux, so the children get a copy of the entire state of the parent process. But under Windows, child processes are freshly spun-up Python interpreters with none of the data structures or open connections of the parent process available. This means that code that tests fine under Linux, because it is depending on residual parent state in a way that the programmer has not noticed, can fail spectacularly under Windows. Therefore, the multiprocessing module should offer an option under Linux that ignores the advantage of being able to do a bare fork() and instead spins up a new interpreter instance just like Windows does. Some developers will just use this for testing under Linux, so their test results are valid for Windows too; and some developers might even use this in production, preferring to give up a bit of efficiency under Linux in return for an application that will show the same behavior on both platforms. Either way, an option that lets the developer subvert the simple sys.platform != 'win32' check in forking.py would go a long way towards helping us write platform-agnostic Python programs. -- components: Library (Lib) messages: 105719 nosy: brandon-rhodes priority: normal severity: normal status: open title: multiprocessing needs option to eschew fork() under Linux type: feature request versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8713] multiprocessing needs option to eschew fork() under Linux
Brandon Craig Rhodes bran...@rhodesmill.org added the comment: Jesse, it's great to learn it's on your wish list too! Should I design the patch so that (a) there is some global in the module that needs tweaking to choose the child creation technique, or (b) that an argument to the Process() constructor forces a full interpreter exec to make all platforms match, or (c) that a process object once created has an attribute (like .daemon) that you set before starting it off? Or (d) should there be a subclass of Process that, if specifically used, has the fork/exec behavior instead of just doing the fork? My vote would probably be for (b), but you have a much better feel for the library and its style than I do. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8517] Apple Style Guide link is broken in the Documenting Python chapter
New submission from Brandon Craig Rhodes bran...@rhodesmill.org: On this page, the Style Guide for people who want to try contributing to the Python documentation: docs.python.org/documenting/style.html there is a broken link to the Apple Style Guide. The 2008 edition now seems gone and people are now apparently supposed to visit: http://developer.apple.com/Mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf -- assignee: georg.brandl components: Documentation messages: 104077 nosy: brandon-rhodes, georg.brandl severity: normal status: open title: Apple Style Guide link is broken in the Documenting Python chapter versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8517 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8144] muliprocessing shutdown infinite loop
New submission from brandon drr...@gmail.com: Multiprocessing goes into an infinite loop during shutdown, trying to connect to a remote queue - I *think* during finalization. The actual loop appears to be the while(1) in connection.py line 251, and I think it is being called initially from manager.py finalization. I can reliably reproduce but my code base is large and ugly, and I am still trimming down to a nice clean sample to submit. -- messages: 101078 nosy: drraid severity: normal status: open title: muliprocessing shutdown infinite loop type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8144 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8144] muliprocessing shutdown infinite loop
brandon drr...@gmail.com added the comment: After getting into the infinite loop, here's exception from CTRL-C (posted just to show stack trace -- i am still working on getting come sample code together -- meant to show it is infact in that while(1) a 251 in connection.py): KeyboardInterrupt ^CError in atexit._run_exitfuncs: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 260, in _exit_function _run_finalizers(0) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 235, in _run_finalizers finalizer() File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 174, in __call__ res = self._callback(*self._args, **self._kwargs) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/managers.py, line 773, in _decref conn = _Client(token.address, authkey=authkey) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/connection.py, line 134, in Client c = SocketClient(address) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/connection.py, line 258, in SocketClient time.sleep(0.01) KeyboardInterrupt Error in sys.exitfunc: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 260, in _exit_function _run_finalizers(0) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 235, in _run_finalizers finalizer() File /home/drraid/code/fuzzer/fuzznet/multiprocessing/util.py, line 174, in __call__ res = self._callback(*self._args, **self._kwargs) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/managers.py, line 773, in _decref conn = _Client(token.address, authkey=authkey) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/connection.py, line 134, in Client c = SocketClient(address) File /home/drraid/code/fuzzer/fuzznet/multiprocessing/connection.py, line 258, in SocketClient time.sleep(0.01) KeyboardInterrupt -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8144 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7297] Releasing FamousFoodFinder.com
span style=font-family:#39;Times New Roman#39;;font-size:mediumdiv style=background-repeat:initial;background-color:rgb(255, 255, 255);padding-top:0.6em;padding-right:0.6em;padding-bottom:0.6em;padding-left:0.6em;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px span class=Apple-style-span style=font-family: monospace; font-size: 13px; white-space: pre-wrap; For the past 2 months a friend and I have been working on a site (a href=http://www.famousfoodfinder.com;www.famousfoodfinder.com/a) that would allow users to search for famous restaurants. The idea initially came from the fact that I love food and have been considering traveling around the US for quite some time. I couldn#39;t think of a better way to enjoy good food and travel than to hit up all the places that I saw on all my favorite shows. Searching online didn#39;t reveal any site that contained multiple shows and allowed me to filter my searches. Rather then wait for someone to add the shows I wanted or the searching capabilities I felt were necessary, I decided to create my own. The site currently supports 5 popular shows:brulliquot;Diners, Drive-Ins and Divesquot;/liliquot;Feasting on Asphalt 1quot;/liliquot;Feasting on Asphalt 2quot;/liliquot;The Best Thing I Ever Atequot;quot;Throwdown with Bobby Flayquot;/li /ul/span/divdiv style=background-repeat:initial;background-color:rgb(255, 255, 255);padding-top:0.6em;padding-right:0.6em;padding-bottom:0.6em;padding-left:0.6em;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px span class=Apple-style-span style=font-family: monospace; font-size: 13px; white-space: pre-wrap; We are currently working on adding more details to each show as well as a few other shows that feature more restaurants. The site is still in beta, but we wanted to release it in it#39;s current state so that users could suggest ideas on how to improve the design/functionality. We hope you find it as useful as we do.br /span/divdiv style=background-repeat:initial;background-color:rgb(255, 255, 255);padding-top:0.6em;padding-right:0.6em;padding-bottom:0.6em;padding-left:0.6em;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px font class=Apple-style-span face=monospace size=3span class=Apple-style-span style=font-size: 13px; white-space: pre-wrap;Please send any feedback, comments, or requests to: a href=mailto:bran...@famousfoodfinder.com;bran...@famousfoodfinder.com/a./span/font/div /spanbr-- brBrandon Dixon - CCNA, OSCP, WebSphere DataPower Solution DeveloperbrInformation Systems Security Engineerbra href=http://www.dueyesterday.net; target=_blankwww.dueyesterday.net/a - Documentation for the massesbr a href=http://www.famousfoodfinder.com; target=_blankwww.famousfoodfinder.com/a - Search for famous restaurants around you!br span style=font-family:#39;Times New Roman#39;;font-size:mediumdiv style=background-repeat:initial;background-color:rgb(255, 255, 255);padding-top:0.6em;padding-right:0.6em;padding-bottom:0.6em;padding-left:0.6em;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px span class=Apple-style-span style=font-family: monospace; font-size: 13px; white-space: pre-wrap; For the past 2 months a friend and I have been working on a site (a href=http://www.famousfoodfinder.com;www.famousfoodfinder.com/a) that would allow users to search for famous restaurants. The idea initially came from the fact that I love food and have been considering traveling around the US for quite some time. I couldn#39;t think of a better way to enjoy good food and travel than to hit up all the places that I saw on all my favorite shows. Searching online didn#39;t reveal any site that contained multiple shows and allowed me to filter my searches. Rather then wait for someone to add the shows I wanted or the searching capabilities I felt were necessary, I decided to create my own. The site currently supports 5 popular shows:brulliquot;Diners, Drive-Ins and Divesquot;/liliquot;Feasting on Asphalt 1quot;/liliquot;Feasting on Asphalt 2quot;/liliquot;The Best Thing I Ever Atequot;quot;Throwdown with Bobby Flayquot;/li /ul/span/divdiv style=background-repeat:initial;background-color:rgb(255, 255, 255);padding-top:0.6em;padding-right:0.6em;padding-bottom:0.6em;padding-left:0.6em;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px span class=Apple-style-span style=font-family: monospace; font-size: 13px; white-space: pre-wrap; We are currently working on adding more details to each show as well as a few other shows that feature more restaurants. The site is still in beta, but we wanted to release it in it#39;s current state so that users could suggest ideas on how to improve the design/functionality. We hope you find it as useful as we do.br /span/divdiv style=background-repeat:initial;background-color:rgb(255, 255,
[issue7250] wsgiref.handlers.CGIHandler caches os.environ, leaking info between requests
Brandon Bloom snprbo...@gmail.com added the comment: That is, in a true CGI environment, there can't be *multiple* requests made to CGIHandler, and so it can't leak. In normal (i.e. pre-GAE) long-running web environments, os.environ would not contain any request information, only the process startup environment. That's fair. In this case the CGIHandler should raise an exception on subsequent requests to prevent this programming error. If someone wants to provide a GAEHandler class, great; otherwise, the documented way to run a WSGI app under GAE is the google.appengine.ext.webapp.util.run_wsgi_app function. I'm not sure if run_wsgi_app was available right from the start, as some early tutorials and samples show using CGIHandler. That's how we ran into this issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7250 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com