[issue46164] New `both()` operator for matching multiple variables to one
New submission from Billy : A new `both()` operator for matching multiple variables to one at the same time. Currently, ```py if a == 1 and b == 1: ... ``` With a `both()` operator, it can be done as follows (concept): ```py if both(a, b) == 1: ... ``` Why? -> With the increasing number of variables, it may be hard to compare each of them at once, hence this operator can help a lot in such situations. Of course, using lists appropriately can solve this issue easily, but a general-direct method for achieving this would be a lot helpful. This also makes the code more simplistic and easily readable and understandable. *Sorry for the bad formatting if markdown is not supported for this comment section, I couldn't find it mentioned anywhere in the python developer's guide. Hence I'm assuming it is supported since it's a common and highly needed feature nowadays. -- messages: 409091 nosy: billyeatcookies priority: normal severity: normal status: open title: New `both()` operator for matching multiple variables to one type: enhancement ___ Python tracker <https://bugs.python.org/issue46164> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22107] tempfile module misinterprets access denied error on Windows
Billy McCulloch added the comment: I stand by the patch file I previously submitted on 2016-05-04. A more detailed analysis / description of my reasoning follows. Change 1 in _get_default_tempdir: A PermissionError is thrown on Windows if you attempt to create a file whose filename matches an existing directory. As the code currently stands, the `if` statement checks whether the proposed file's *parent* directory is a directory (which it is, or a FileNotFoundError would have been thrown), instead of whether the proposed filename conflicts with an existing directory. The edited expression is really a typo that, in the context of the code block, always evaluates `True`. Here’s what we’re now saying in the `if` block: when a PermissionError is raised, if we’re on Windows (the only currently supported platform to throw nonsense errors at us) AND the filename we chose simply conflicts with an existing directory AND we supposedly have write access to the parent directory, then we were just unlucky with the chosen name and should try again in the same parent directory. (I say supposedly because Windows seems to erroneously report True on this check, even when we don’t have write access. I wouldn’t be surprised if this last check does something useful in certain contexts, I just don’t know what they are.) Change 2 in _mkstemp_inner: Same as above for Change 1. While _get_default_tempdir uses this code block to make sure the system tempdir is really writable, and _mkstemp_inner does it so that a file descriptor can be returned, the result and arguments are the same. Change 3 in mkdtemp: For _get_default_tempdir and _mkstemp_inner, the blocks of code in question are creating temporary files. As such, they need to handle the oddball case for Windows where attempts to create a file with a filename which conflicts with an existing directory name result in a PermissionError. The same block of error handling code is copied in mkdtemp, even though this function never tries to create a file – it only tries to create a directory. As such, in the case that we try to create a directory with a name that already exists (whether as a file or a directory), we wouldn't be dealing with a PermissionError, we'd have a FileExistsError, which is already handled in mkdtemp by the preceding lines. The only way I’ve seen a PermissionError crop up for a call to mkdir on Windows is if the user doesn’t have permission to create filesystem objects in the parent directory. This is the intended usage of a PermissionError, so no special handling needed is required. Remember, a PermissionError shouldn’t happen if mkdtemp is called without a `dir` kwarg, because the _sanitize_params will invoke _get_default_tempdir, which will check to ensure that the parent directory is writable. As such, this block of code was superfluous, and the patch should not raise PermissionError in user code where it previously was caught. -- ___ Python tracker <https://bugs.python.org/issue22107> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28274] asyncio does not call exception handler if task stored
New submission from Billy Foster: I found a very strange bug in asyncio where whether exception handlers are called depends on whether a task is stored. To illustrate, the following code works as expected, printing out that it made it to the exception handler: import asyncio async def run(): raise RuntimeError def exception_handler(loop, context): print('Made it to exception handler.') loop = asyncio.get_event_loop() loop.set_exception_handler(exception_handler) loop.create_task(run()) loop.run_forever() However, if you take that exact same code but store the task that is returned from create_task, the exception handler will NOT be called: import asyncio async def run(): raise RuntimeError def exception_handler(loop, context): print('Made it to exception handler.') loop = asyncio.get_event_loop() loop.set_exception_handler(exception_handler) task = loop.create_task(run()) loop.run_forever() This is completely bizarre, and I have been unable to track down the reason. -- components: asyncio messages: 277394 nosy: billyfoster, gvanrossum, yselivanov priority: normal severity: normal status: open title: asyncio does not call exception handler if task stored versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22107] tempfile module misinterprets access denied error on Windows
Billy McCulloch added the comment: I've also run into this bug on Windows. In my case, the tempdir path includes directories on a network share, which I lack write access permissions to. Python tries to generate a *lot* of files, and never figures out it should move on to another directory. The attached patch for tempdir.py resolves my issue. In _get_default_tempdir() and _mkstemp_inner(), you want to know if the filename you tried to create already exists as a directory, not whether the parent directory is a directory – that's handled in _get_default_tempdir(). In mkdtemp(), attempting to create a directory with the same name as an existing directory does not throw a PermissionError, so the code is superfluous. -- nosy: +Billy McCulloch Added file: http://bugs.python.org/file42704/master...bjmcculloch_patch-1.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22107> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12978] Figure out extended attributes on BSDs
Billy Foster added the comment: Is there any chance of getting this finalized? I have been using William Orr's patch as a workaround for months now, but it would be nice to not have to manually apply it each version bump... -- nosy: +billyfoster ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12978 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22699] cross-compilation of Python3.4
New submission from Billy: Who knows to cross-compile Python 3.4? -- messages: 229828 nosy: bill9889 priority: normal severity: normal status: open title: cross-compilation of Python3.4 type: resource usage versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22659] SyntaxError in the configure_ctypes
New submission from Billy: Hi all, I have a issue with the cross-compilation, here I let it: File ../src/setup.py, line 1849 exec(f.read(), globals(), fficonfig) SyntaxError: unqualified exec is not allowed in function 'configure_ctypes' it contains a nested function with free variables make[1]: *** [sharedmods] Error 1 Who wants to help me, please Best regards. -- components: Cross-Build messages: 229584 nosy: bill9889 priority: normal severity: normal status: open title: SyntaxError in the configure_ctypes type: compile error versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22659 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22654] issue with PYTHON_FOR_BUILD
New submission from Billy: Hi all, I've been cross-compiling Python3.4.1, but I have a issue than is following: _PYTHON_PROJECT_BASE=/home/aphillips/work/leo368-20141008/fs/apps/python-3.4.1/arm _PYTHON_HOST_PLATFORM=linux-arm PYTHONPATH=../src/Lib:../src/Lib/plat-linux -S -m sysconfig --generate-posix-vars ; \ if test $? -ne 0 ; then \ echo generate-posix-vars failed ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi /bin/sh: -S: command not found generate-posix-vars failed make[1]: *** [pybuilddir.txt] Error 1 If who knows about that, could you help me. Best regards. -- components: Cross-Build messages: 229553 nosy: bill9889 priority: normal severity: normal status: open title: issue with PYTHON_FOR_BUILD type: compile error versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22654] issue with PYTHON_FOR_BUILD
Billy added the comment: Yes, I applied a patch in the configure for than it can make the configuration. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22654] issue with PYTHON_FOR_BUILD
Billy added the comment: Ned Deil, For my application I need to use Python 3.4.1 and Why do I need to run the ./configure for second time?. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22654] issue with PYTHON_FOR_BUILD
Billy added the comment: I added a patch for the resolution of the issue but it didn't work. You can see in my first comment than there is a issue with PYTHONPATH, Do you know why happen that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11652] urlib2 returns a pair of integers as the content-length value
New submission from Billy Saelim sae...@gmail.com: urlopen does not always return a single value for 'content-length'. For example: import urllib2 request = 'http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.1.11.zip' fp = urllib2.urlopen(request) fp.info().dict {'content-length': '289519, 289519', 'x-varnish': '929586024', 'via': '1.1 varnish', 'age': '0', 'expires': 'Fri, 25 Mar 2011 14:36:43 GMT', 'server': 'Apache/2.2.3 (CentOS)', 'last-modified': 'Sat, 07 Feb 2009 19:15:15 GMT', 'connection': 'close', 'etag': '46aef-46258f510b6c0', 'date': 'Wed, 23 Mar 2011 14:36:43 GMT', 'content-type': 'application/zip'} -- components: Library (Lib) messages: 131894 nosy: Billy.Saelim priority: normal severity: normal status: open title: urlib2 returns a pair of integers as the content-length value type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11652 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com