New submission from Vajrasky Kok:
Both python2 and python3 have this behaviour.
>>> import os; os.getuid()
0
>>> 'I am root'
'I am root'
>>> import spwd
>>> spwd.getspnam('bin')
spwd.struct_spwd(sp_nam='bin',
Vajrasky Kok added the comment:
Attached the second patch to use addCleanup rather than tear down method. Also,
I added the non-existent file case.
--
Added file:
http://bugs.python.org/file31232/fix_resource_warning_read_mime_types_v2.patch
Vajrasky Kok added the comment:
I read the patch. It looks good.
Anyway, I have two questions:
1. I saw 3 variants of writing description for skipping test descriptor:
requires os.mkfifo
test needs socket.inet_pton()
needs os.read
Which one is the preferred way to go? "requires"
Vajrasky Kok added the comment:
Thanks, Benjamin, for reviewing my patch.
Attached the fourth patch to wrap the "business" part inside the try ...
finally.
--
Added file:
http://bugs.python.org/file31237/formatter_fix_resource_warnin
Vajrasky Kok added the comment:
Ah, sorry about that.
Attached the fifth patch to only wrap "for loop" section inside the try...
finally.
--
Added file:
http://bugs.python.org/file31238/formatter_fix_resource_warning_v5.patch
___
Pyth
Vajrasky Kok added the comment:
It happens because if the length of data is more than 1000:
def __write(self, line):
"""line is always bytes, not string"""
if self.__file is not None:
if self.__file.tell() + len(line) >
Vajrasky Kok added the comment:
Superseded by bug #18394.
Should we close this one by marking it as duplicate?
--
nosy: +vajrasky
___
Python tracker
<http://bugs.python.org/issue18
New submission from Vajrasky Kok:
In shorten function of textwrap module, the placeholder becomes a hole where we
can inject non-normalized whitespaces to the text.
>>> text = "Hello there, how are you this fine day? I'm glad to hear it!"
>>> from textwrap im
Vajrasky Kok added the comment:
Okay, nevermind about non-normalized whitespaces in placeholder, but what about
this case?
>>> text = "Hello there, how are you this fine day? I'm glad to hear it!"
>>> from textwrap import shorten
>>> shorten(text, 10
Vajrasky Kok added the comment:
> Do you want to write a patch?
My pleasure.
Attached the second version of the patch to accomodate Pitrou's request.
--
Added file:
http://bugs.python.org/file31274/fix_for_non_normalized_whitespaces_in_placeholder_
Vajrasky Kok added the comment:
Attached more refined patch. Removed unnecessary test. Added more robust test.
Added shorten in __all__.
--
Added file:
http://bugs.python.org/file31275/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch
Changes by Vajrasky Kok :
Removed file:
http://bugs.python.org/file31275/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch
___
Python tracker
<http://bugs.python.org/issue18
Changes by Vajrasky Kok :
Added file:
http://bugs.python.org/file31276/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch
___
Python tracker
<http://bugs.python.org/issue18
Vajrasky Kok added the comment:
What about newline keyword argument?
Are we forcing the newline to be '\n'? Alternate newlines will be useful for
Windows platform ('\r\n') and HTML platform ('').
--
___
Python tr
Vajrasky Kok added the comment:
I missed this case:
>>> from textwrap import shorten
>>> shorten('hell', 4)
Traceback (most recent call last):
File "", line 1, in
File "/home/sky/Code/python/programming_language/cpython/Lib/textwrap.py",
Vajrasky Kok added the comment:
Okay, attached the fifth version not to care about the case where text is
smaller than the placeholder.
--
Added file:
http://bugs.python.org/file31278/fix_for_non_normalized_whitespaces_in_placeholder_v5.patch
Vajrasky Kok added the comment:
Hi Alex.
Typo in "#Speicify subdirectories to hide".
I think you should not create WIN32 constant. Use this statement instead:
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
I think you should use addCle
New submission from Vajrasky Kok:
Test enum json in Lib/test/test_json/test_enum.py is ignorant of infinity
values. Also, NaN, but since NaN is a weirdo, let's not take that into account.
The unit test should represent of what will work in every case. For example:
def test_floats
New submission from Vajrasky Kok:
>>> import ssl
>>> ssl.RAND_egd.__doc__
"RAND_egd(path) -> bytes\n\nQueries the entropy gather daemon (EGD) on the
socket named by 'path'.\nReturns number of bytes read. Raises SSLError if
connection to EGD\nfails or if
New submission from Vajrasky Kok:
When a signal handler fails to write to the file descriptor registered with
``signal.set_wakeup_fd()``, an exception does not report which the file
descriptor is the problematic one.
Attached the patch to put the file descriptor in the aforementioned
Vajrasky Kok added the comment:
Same patch, but more pep8 compliant.
--
Added file:
http://bugs.python.org/file31347/add_file_descriptor_to_exception_signal_set_wakeup_fd_v2.patch
___
Python tracker
<http://bugs.python.org/issue18
Vajrasky Kok added the comment:
Sorry,
When I read "... wakeup fd:\n" my subconsciousness mind automatically
translated it to "... wakeup fd: %d\n". Then you made me realized there is
another error message below it.
I closed this ticket as invalid.
--
resolution
New submission from Vajrasky Kok:
I read this commit:
http://hg.python.org/cpython/rev/1d5f644b9241
But I noticed there is still GNU Pth code lingering around in
Modules/signalmodule.c.
Beside of that the WITH_PTH code (in the same file) is expired already. If you
configure python with this
Vajrasky Kok added the comment:
Attached the patch to accommodate R. David Murray's request. Accessing invalid
attributes such as sp_nam and sp_pwd from spwd tuple will generate deprecation
warning message.
Also, I added test function so we can run spwd module directly. This is u
New submission from Vajrasky Kok:
According to:
http://oald8.oxfordlearnersdictionaries.com/dictionary/alphanumeric
http://en.wikipedia.org/wiki/Alphanumeric
Alphanumeric is defined as [A-Za-z0-9]. Underscore (_) is not one of them. One
of the documentation in Python (Doc/tutorial/stdlib2.rst
Vajrasky Kok added the comment:
In Lib/re.py, starting from line 77 (Python 3.4):
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will
New submission from Vajrasky Kok:
$ ./python --version
Python 2.7.5+
$ ./python
Python 2.7.5+ (2.7:062533327ad2, Aug 19 2013, 22:44:52)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more
New submission from Vajrasky Kok:
As root:
$ sudo python3
[sudo] password for ethan:
Python 3.2.3 (default, Apr 10 2013, 05:07:54)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import spwd
&
Vajrasky Kok added the comment:
Attached the patch to accomodate Serhiy Storchaka's suggestion by using
KeyError exception for backward compatibility.
--
Added file: http://bugs.python.org/file31382/fix_error_message_getspnam_v2.patch
___
P
Vajrasky Kok added the comment:
Attached the patch to raise OSError instead of returning empty list if a normal
user uses getspall function of spwd module.
I investigated about this issue. There exists situation where /etc/shadow file
does not exist:
https://bugs.kde.org/show_bug.cgi?id
Vajrasky Kok added the comment:
Sorry about that.
Okay, so for now, we wait for other people's suggestion, which way we should
use to handle this situation?
--
___
Python tracker
<http://bugs.python.org/is
New submission from Vajrasky Kok:
$ ./python
Python 3.4.0a1+ (default:afb1b4797419, Aug 21 2013, 09:54:46)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> import sys
>&
New submission from Vajrasky Kok:
Typo in line 11:
# Skip test if no fnctl module.
Unused variables rv in test_fcntl_file_descriptor method.
Attached the patch to clean up the test.
--
components: Tests
files: fix_typo_unused_variables_in_test_fcntl.patch
keywords: patch
messages
New submission from Vajrasky Kok:
There is a dormant test in Lib/test/test_xmlrpc.py (line 579):
# [ch] The test 404 is causing lots of false alarms.
def XXXtest_404(self):
# send POST with http.client, it should return 404 header and
# 'Not Found' message.
Vajrasky Kok added the comment:
Yes, I agree with you, R. David Murray.
But there are some reasons why I try to resurrect this dormant test:
1. This test was disabled on 19 January 2008.
http://hg.python.org/cpython/rev/859bf85a556a
It has been more than 5 years. Many things happened.
2. In
Vajrasky Kok added the comment:
http://bugs.python.org/review/15204/diff/9032/Tools/iobench/iobench.py
Line 10 in New:
import io
But io module is never used.
--
nosy: +vajrasky
___
Python tracker
<http://bugs.python.org/issue15
Vajrasky Kok added the comment:
Some typos on last commit
"current time (miliseconds or seconds) and an uninitialized arry."
should be
"current time (miliseconds or seconds) and an uninitialized array."
"instead of a child handler because fork() is suppose to be
New submission from Vajrasky Kok:
The python is compiled with debug option.
cpython$ ./python Lib/aifc.py Lib/test/sndhdrdata/sndhdr.aiff
Reading Lib/test/sndhdrdata/sndhdr.aiff
nchannels = 2
nframes = 5
sampwidth = 2
framerate = 44100
comptype = b'NONE'
compname = b'not co
Vajrasky Kok added the comment:
This is the preliminary patch to fix the error message.
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file31462/fix_error_message_reader_csv.patch
___
Python tracker
<http://bugs.python.
Vajrasky Kok added the comment:
This is the second alternative of the patch to fix the error message using
different approach. I am not sure which one is better.
--
Added file:
http://bugs.python.org/file31463/fix_error_message_reader_csv_alternative_1.patch
Vajrasky Kok added the comment:
I realized there was a test that was similar with my test. I merged them into
one test.
I think the alternative is better than the original patch so I updated the
alternative patch only.
--
Added file:
http://bugs.python.org/file31467
Vajrasky Kok added the comment:
Apparently, other attributes of the csv dialect beside delimiter, such as
escapechar and quotechar share the same problem.
>>> import _csv
>>> _csv.reader('foo', quotechar=b'"')
Traceback (most recent call last):
Fil
New submission from Vajrasky Kok:
The python is compiled with --with-pydebug flag.
[sky@localhost cpython]$ cat /tmp/quote.txt
manly "man" likes 'cute "cat"'
[sky@localhost cpython]$ ./python Lib/shlex.py /tmp/quote.txt
Token: 'manly'
Token: '&quo
Vajrasky Kok added the comment:
What about if you extend the test coverage as well? Right now, we don't have
test to test getclasstree method with unique parameter set to false.
--
nosy: +vajrasky
___
Python tracker
<http://bugs.py
New submission from Vajrasky Kok:
In Lib/test/test_os.py in class FDInheritanceTests, we have an unnecessary
test, which is test_set_inheritable. What test_set_inheritable tests is already
being covered by test_get_inheritable.
Also, I think test_get_inheritable should be renamed to
Vajrasky Kok added the comment:
To test the infinity, negative infinity, and NaN (Not a Number), you named the
test as test_weird_floats. So implicitely, you admitted that they are floats
but just weird. Yet, you named the sample data test class as NotNum.
Implicitely, you were saying they
Vajrasky Kok added the comment:
Attached the patch to accomodate Ezio Melotti's request. The patch now have two
separate errors for "wrong type" and "right type, wrong length".
Don't we break compatibility by changing the type of exception from TypeError
to Valu
Vajrasky Kok added the comment:
Same as fix_error_message_reader_csv_alternative_1_v4.patch (by Serhiy), but I
removed unused variables in the test.
--
Added file:
http://bugs.python.org/file31614/fix_error_message_reader_csv_alternative_1_v5.patch
New submission from Vajrasky Kok:
File Misc/NEWS, line 65 & 66:
- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in
the _sre moduel.
"moduel" => "module"
Related commit:
http://hg.python.org/cpython/rev/c41c68a18bb6
--
assig
New submission from Vajrasky Kok:
In commit about "implementation of the PEP 446: file descriptors and file
handles are now created non-inheritable", there are some grammatically
incorrect sentences in Python/fileutils.c.
Please see the patch for details.
Related commit:
http://hg.
New submission from Vajrasky Kok:
In Lib/importlib/util.py, the documentation is confusing me.
Line 42 & 43:
If an exception is raised and the decorator created the module it is
subsequently removed from sys.modules.
Is it supposed to be:
"If an exception is raise
Vajrasky Kok added the comment:
Do you mean something like *this*?
this -> the patch, pythonfaulthandler_env_var.patch.
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file31641/pythonfaulthandler_env_var.patch
___
Pyt
Vajrasky Kok added the comment:
That would help.
--
___
Python tracker
<http://bugs.python.org/issue18955>
___
___
Python-bugs-list mailing list
Unsubscribe:
Vajrasky Kok added the comment:
I noticed in CPython source code, when we print the type of the object, we use
"%.200s" not "%s". For example, in Modules/posixmodule.c:
"uid should be integer, not %.200s",
So the newest path was created to conform with this tradi
Vajrasky Kok added the comment:
>>> a = open('/tmp/input.json')
>>> b = a.read()
>>> b[0]
'\ufeff'
>>> import json
>>> json.loads(b[1:])
loads just fine
>>> json.loads(b)
chokes.
Whether python json module shoul
Vajrasky Kok added the comment:
The U+FEFF character is related with Byte order mark.
Reference:
http://en.wikipedia.org/wiki/Byte_Order_Mark
--
___
Python tracker
<http://bugs.python.org/issue18
Vajrasky Kok added the comment:
Well, what about None?
$ python3 -c 'import csv; reader = csv.reader("foo", delimiter=None)'
Traceback (most recent call last):
File "", line 1, in
TypeError: delimiter must be set
English grammatically speaking, we should get
Vajrasky Kok added the comment:
David R. Murray said, '"delimiter must be a 1 character string" would cover it.'
You mean
$ ./python -c 'import csv; reader = csv.reader("foo", delimiter="")'
should give this error '"delimiter"
Vajrasky Kok added the comment:
Sorry for typing your name wrongly.
s/David R. Murray/R. David Murray/
--
___
Python tracker
<http://bugs.python.org/issue18
Vajrasky Kok added the comment:
I don't see any patches. You forgot to upload the patch?
--
nosy: +vajrasky
___
Python tracker
<http://bugs.python.org/is
Vajrasky Kok added the comment:
After contemplating for a while, I am not sure that we should treat empty
string for delimiter with error message: '"delimiter" must be an 1-character
string'.
The reason is to keep consistency with quotechar keyword.
[sky@localhost c
New submission from Vajrasky Kok:
The attached patch fixed typos and improved the documentation to improve the
clarity in Modules/fcntlmodule.c.
Please see the attached patch and feel free to disagree with the improvement.
--
assignee: docs@python
components: Documentation
files
New submission from Vajrasky Kok:
In Lib/unittest/test/testmock/testmock.py, there are two
test_attribute_deletion. One of them is overshadowed (not executed) by the
other.
def test_attribute_deletion(self):
# this behaviour isn't *useful*, but at least it's
New submission from Vajrasky Kok:
In Modules/fcntlmodule.c, there is a code to insert symbolic constants to the
module.
all_ins(m);
But we don't check the return code of the function whether it is successful or
not, unlike in posix module in which we check it.
if (all_
New submission from Vajrasky Kok:
cutecat@amiau:~/cpython$ cat /tmp/innerplanets.py
from enum import Enum
class innerplanets(Enum):
mercury = 1
venus = 2
earth = 3
mars = 4
for planet in innerplanets:
print(planet)
for planet in reversed(innerplanets):
print(planet
Vajrasky Kok added the comment:
Simplified unit test. I reused enum Season in the test class.
By the way, there is another way to add support for enum without implementing
__reversed__ method, which is adding support indexing by number (in __getitem__
method), e.g. Season[1] => Season.SPR
Vajrasky Kok added the comment:
There is a typo.
s/io.pen/io.open/
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file34617/fix_typo_21058.patch
___
Python tracker
<http://bugs.python.org/issue21
Vajrasky Kok added the comment:
Thanks for committing my patch, Yury. But you forgot to remove
Lib/test/test_asyncio/tests.txt.
--
___
Python tracker
<http://bugs.python.org/issue20
Vajrasky Kok added the comment:
Thanks, Serhiy, for the review! Here is the updated patch.
--
Added file: http://bugs.python.org/file35347/unittest_for_spwd_v3.patch
___
Python tracker
<http://bugs.python.org/issue19
Vajrasky Kok added the comment:
I found the culprit. The AddressFamily is not registered in _socket module. I
created a preliminary patch to show the culprit.
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file35379/pydoc_display_AddressFamily.patch
New submission from Vajrasky Kok:
In Lib/asyncio/base_events.py, we have these lines of code:
---
def attach(self, transport):
assert self.sockets is not None
self.active_count += 1
def detach(self, transport
Vajrasky Kok added the comment:
Yeah, I remember I tried to improve the performance of the median in the past
using median-of-k algorithm. But too bad I could not beat sorted C function
efficiency. Maybe you have a better luck!
--
nosy: +vajrasky
New submission from Vajrasky Kok:
https://docs.python.org/3.5/library/asyncio-task.html#task
The cancel method is not documented although it is a part of public API. Here
is the patch to fix the doc.
--
assignee: docs@python
components: Documentation
files: fix_doc_asyncio_task.patch
Vajrasky Kok added the comment:
Here is the simple patch based on David Murray's thought.
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file35413/bytes_parser_dont_close_file.patch
___
Python tracker
<http://bugs.py
Vajrasky Kok added the comment:
Thank you, Serhiy, for the review! Here is the updated patch.
--
Added file:
http://bugs.python.org/file35418/bytes_parser_dont_close_file_v2.patch
___
Python tracker
<http://bugs.python.org/issue21
Changes by Vajrasky Kok :
--
versions: +Python 3.5 -Python 3.4
___
Python tracker
<http://bugs.python.org/issue19145>
___
___
Python-bugs-list mailing list
Unsub
Vajrasky Kok added the comment:
Serhiy, here is the latest patch incorporating your request.
--
Added file:
http://bugs.python.org/file35420/bytes_parser_dont_close_file_v3.patch
___
Python tracker
<http://bugs.python.org/issue21
Vajrasky Kok added the comment:
The Parse class does not throw exception if given invalid message:
Assume /tmp/a.txt contains garbage, such as: "&&&&&"
With this code:
with open("/tmp/a.txt", "r") as fp:
msg = email.pa
Vajrasky Kok added the comment:
Ok, here is the updated patch based on R. David Murray's help. Thanks!
--
Added file:
http://bugs.python.org/file35424/bytes_parser_dont_close_file_v4.patch
___
Python tracker
<http://bugs.python.org/is
Vajrasky Kok added the comment:
Here is the patch based on R. David Murray's nitpick.
--
Added file:
http://bugs.python.org/file35537/bytes_parser_dont_close_file_v5.patch
___
Python tracker
<http://bugs.python.org/is
New submission from Vajrasky Kok:
import asyncio
loop = asyncio.get_event_loop()
q = asyncio.Queue(maxsize=1.2, loop=loop)
q.put_nowait(1)
q.put_nowait(1)
q.put_nowait(1)
q.put_nowait(1)
q.put_nowait(1)
and so on
It seems counter intuitive for my innocent eyes. As comparison with the
Vajrasky Kok added the comment:
"It looks strange to use a float as maxsize." => It is. But the float could be
coming programmatically. Float value interpreted as infinity could give a shock
for some people.
"maybe to cast maxsize parameter to an int."
New submission from Vajrasky Kok:
subprocess_shell in asyncio accepts cmd as a string or a bytes but the test
unit, the documentation and the exception indicates that it only accepts a
string.
--
assignee: docs@python
components: Documentation, asyncio
files
Vajrasky Kok added the comment:
Here is the patch based on Claudiu's comment and Serhiy's commit
(http://hg.python.org/cpython/rev/4b187f5aa960).
Claudiu (Thanks!!!), I can not apply two of your suggestions:
"You could use support.import_module here in order to skip the test i
Vajrasky Kok added the comment:
The first test fails. I already tested it.
I think they test the same thing, what happens to the attribute of mock
instance if you delete it.
--
___
Python tracker
<http://bugs.python.org/issue18
Vajrasky Kok added the comment:
Okay, I found the difference.
The second test case is to test the case on which we delete the attribute of
the mock instance before being referenced by any variable. The we make sure the
attribute is gone for good.
The first test case is to test the case on
Vajrasky Kok added the comment:
Michael, attached the patch to accommodate your request. Yeah, I think this is
the best way because I have seen no possible solutions to make both tests work
without altering them.
Xavier, that's cool. I didn't know such tool exists. Usually I
Vajrasky Kok added the comment:
Charles-François Natali, sorry I just noticed Ezio's comment. The all_ins
function return -1 on failure and 0 on success.
I use this form:
if (all_ins(m))
return NULL;
because I follow the example in Modules/posixmodule.c. If this form:
New submission from Vajrasky Kok:
>>> from enum import Enum
>>> class MyPet(Enum):
... CUTE_CAT = 1
... VIGOROUS_DOG = 2
... UGLY_BLOBFISH = 3
... PROMISCUOUS_BONOBO = 4
... def spam(cls): pass
...
>>> del MyPet.CUTE_CAT
Traceback (most recent call l
Vajrasky Kok added the comment:
Here is the patch containing unit test only to confirm existing behaviour. So
people can learn what to expect when they delete Enum attributes.
Even if we *decide* to change the behaviour of "del MyPet.CUTE_CAT" (assuming
CUTE_CAT is an Enum member
Vajrasky Kok added the comment:
Updated patch based on Ezio's review. I reverted back the changes to Nul and
module documentation (since it is not so clear whether we should categorize
flock as Unix routine or not).
--
Added file:
http://bugs.python.org/file
Vajrasky Kok added the comment:
> How do you infer the data types for the parameters?
I don't think we can, unless we force them to use function annotation. If they
don't use that feature, then we say the signature is not supported.
The problem is getting deeper if we are talking
New submission from Vajrasky Kok:
Lib/xmlrpc/client.py tries to connect to http://time.xmlrpc.com/RPC2 which has
been dead for a "while". I see there is no light in the end of tunnel. Since
this code is meant to be a demo not a general purpose tool, I say why don't we
direct
Changes by Vajrasky Kok :
Removed file: http://bugs.python.org/file31856/xmlrpc_server_client_demo.patch
___
Python tracker
<http://bugs.python.org/issue19082>
___
___
Changes by Vajrasky Kok :
Added file: http://bugs.python.org/file31857/xmlrpc_server_client_demo.patch
___
Python tracker
<http://bugs.python.org/issue19082>
___
___
Pytho
Vajrasky Kok added the comment:
This is the preliminary patch to raise TypeError in that situation.
--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file31876/urljoin_throws_type_error.patch
___
Python tracker
<h
Vajrasky Kok added the comment:
What test_xmlrpc_net tests (especially the one with time.xmlrpc.com) have been
tested in test_xmlrpc except for connecting to server with dotted_attribute
feature and receiving datetime instance over the network.
That test is not that hard to be migrated to
Vajrasky Kok added the comment:
What about this one?
>>> urljoin(['a'], [])
['a']
>>> urljoin(['a'], ['b'])
. omitted ..
AttributeError: 'list' object has no attribute 'decode'
Is this
Vajrasky Kok added the comment:
I modified the patch to handle the last case using your way as well.
Anyway, I found out that urlsplit and urlparse got the same issue as well.
>>> urlparse('python.org', b'http://')
Traceback (most recent call last):
File "
Vajrasky Kok added the comment:
Here's the preliminary patch. I am assuming that we should accept unicode
argument not reject it straight away.
Python3 does that.
>>> import struct
>>> struct.pack('b', 3)
b'\x03'
>>> struct.pack(b'b
101 - 200 of 574 matches
Mail list logo