[issue33728] pandas.to_records can not be saved by numpy.savez

2018-05-31 Thread Feng


New submission from Feng :

my first time to report a bug here.
But it is so annoying, I have to report it.
Here is the demonstration of the errors I encounter:

>>> import numpy as np
>>> import pandas as pd
>>> np.__version__
'1.14.3'
>>> pd.__version__
u'0.23.0'

>>> df=pd.DataFrame({'a':range(10)})
>>> df['b']='abc'
>>> df
   ab
0  0  abc
1  1  abc
2  2  abc
3  3  abc
4  4  abc
5  5  abc
6  6  abc
7  7  abc
8  8  abc
9  9  abc

>>> np.savez_compressed('abc',data=df.to_records(index=False))
>>> a=np.load('abc.npz')
>>> a.keys()
['data']
>>> a['data']
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.7/site-packages/numpy/lib/npyio.py", line 235, in 
__getitem__
pickle_kwargs=self.pickle_kwargs)
  File "/usr/lib64/python2.7/site-packages/numpy/lib/format.py", line 635, in 
read_array
shape, fortran_order, dtype = _read_array_header(fp, version)
  File "/usr/lib64/python2.7/site-packages/numpy/lib/format.py", line 523, in 
_read_array_header
raise ValueError(msg % (d['descr'],))
ValueError: descr is not a valid dtype descriptor: [(u'a', '
<https://bugs.python.org/issue33728>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11482] Float Plus Error

2011-03-13 Thread Lu Feng

New submission from Lu Feng :

Run 1.1 + 3.2, result is 4.301
And when Run [x * 0.1 for x in range(0, 10)], the result is
[0.0, 0.1, 0.2, 0.30004, 0.4, 0.5, 0.6001, 
0.7001, 0.8, 0.9]

--
messages: 130734
nosy: [email protected]
priority: normal
severity: normal
status: open
title: Float Plus Error
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue11482>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43628] Incorrect argument errors for random.getstate()

2021-03-25 Thread Yang Feng

New submission from Yang Feng :

In documentation of random.getstate(), it says:
“random.getstate()
Return an object capturing the current internal state of the generator. This 
object can be passed to setstate() to restore the state.”

random.getstate() takes 0 argument and return the current setting for the 
weekday to start each week. However, when I give one argument to 
random.getstate(), the interpreter reports the following error:
--
>>> import random
>>> random.getstate(1)
Traceback (most recent call last):
File "", line 1, in 
TypeError: getstate() takes 1 positional argument but 2 were given
--

Here I have two doubts about the reported errors:
1. Is the TypeError correct? This should be an inconsistent argument number 
error. There is nothing to do with Type. 
2. Is the detailed error correct? Doc says random.getstate() takes 0 argument, 
the reported error says getstate() take 1 positional argument. which is 
inconsistent. Besides, I pass one argument to random.getstate(), but the 
reported error says 2 were given.


Environment: Python 3.10, Ubuntu 16.04

--
assignee: docs@python
components: Documentation
messages: 389535
nosy: CharlesFengY, docs@python
priority: normal
severity: normal
status: open
title: Incorrect argument errors for random.getstate()
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue43628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22543] -W option cannot use non-standard categories

2020-01-04 Thread Feng Yu


Feng Yu  added the comment:

Coming here from 
https://github.com/astropy/astropy/issues/9832#issuecomment-570751353

Importing the named module during warning initialization is somewhat like code 
injection. And it may introduce unintended side-effects -- for example if this 
causes some 3rd party libraries to initialize too early?

String matching on the class name of every class in the hierarchy is safer, as 
there is no 'expected' code execution.

--
nosy: +Feng Yu

___
Python tracker 
<https://bugs.python.org/issue22543>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

Seeing the following program, in the second assertRaises(), function 
"test_invalid_adpcm_state()"  is recursively called. Then a fatal Python error 
shows up and the Python interpreter crashes. 

++
import unittest
import audioop

class TestAudioop(unittest.TestCase):
 pass

def test_invalid_adpcm_state():
 TestAudioop.assertRaises(TypeError, audioop.lin2adpcm, b'\x00', 1, 555)
 TestAudioop.assertRaises(test_invalid_adpcm_state(), 
audioop.adpcm2lin, b'\x00', 1, (0, (- 1)))

TestAudioop = TestAudioop()
test_invalid_adpcm_state()

+++

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Library (Lib)
messages: 386763
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  AssertRaises() causes core dump in handling recursion
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43186] Recursive call causes core dump in assertRaises

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In following teststr.py, class MyString is nestedly instanced in method 
__getattr__(). This script will lead to a  "core dump" in Python interpreter.  
My Python version is  3.9.1 and my operating system is Ubuntu 16.04. 

teststr.py
+++
class StrError(str):
pass

class MyString:

def __init__(self, istr):
self.__mystr__ = istr

def __getattr__(self, content):
with self:
return MyString(getattr(self.__mystr__, content))

def __setattr__(self, content, sstr):
setattr(self.__mystr__, content)

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
 raise StrError(self.__mystr__) 
 return True

MyString("hello")
+

--
components: Library (Lib)
messages: 386764
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: Recursive call causes core dump in assertRaises
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43186>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43187] Dict creation in recursive function cause interpreter crashes.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following programs, dict is created in recursive calls. Then a core dump 
is reported by Python interpreter.
+++
def test_equal_operator_modifying_operand():

class X():

def __del__(DictTest):
dict_b.clear()

def __eq__(DictTest, other):
dict_a.clear()
return True

def __hash__(DictTest):
return 13
dict_d = {X(): 0}

class Y():

def __eq__(DictTest, other):
dict_d.clear()
return True
dict_d = {0: Y()}
# dict_c = {0: set()}
test_equal_operator_modifying_operand()

test_equal_operator_modifying_operand()
+

--
components: Interpreter Core
messages: 386765
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: Dict creation in recursive function cause interpreter crashes.
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43187>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43188] multiple operations of dict causes core dump of Python interpreter.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following programs, we call check_reentrant_insertion("s") twice,  after 
multiple of update and clear of dict, the Python interpreter crashes.
+++
def check_reentrant_insertion(mutate):

class Mutating:
def __del__(self):
mutate(d)

d = {k: Mutating() for k in 'abcdefghijklmnopqr'}
for k in list(d):
d[k] = k

def test_reentrant_insertion():

check_reentrant_insertion("s")

def mutate(d):
d.update(DictTest.__dict__)
d.clear()
check_reentrant_insertion(test_reentrant_insertion())

test_reentrant_insertion()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Interpreter Core
messages: 386766
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  multiple operations of dict causes core dump of Python 
interpreter.
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43188>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43189] decorator function run_with_locale() crashes Python interpreter

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

We use run_with_locale() as decorator function, then we recursively call 
test_float__format__locale in the following example. Python interpreter crashes.
+++
from test.support import run_with_locale

@run_with_locale('LC_NUMERIC', 'en_US.UTF8')
def test_float__format__locale():
test_float__format__locale()
test_float__format__locale()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Tests
messages: 386767
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title:  decorator function run_with_locale() crashes Python 
interpreter
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43189>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43190] < test.support > check_free_after_iterating( ) causes core dump in handling iteration.

2021-02-10 Thread Yang Feng


New submission from Yang Feng :

In the following program, we call check_free_after_iterating( ) twice, in the 
second time, we recursively call function test_free_after_iterating(). Python 
interpreter crashes.
+++
import unittest
import test.support

class UnicodeTest(unittest.TestCase):
pass

def test_free_after_iterating():
ut = UnicodeTest()
test.support.check_free_after_iterating(ut, iter, str)
test.support.check_free_after_iterating(str, test_free_after_iterating(), 
str)

test_free_after_iterating()
+

System Info: Ubuntu 16.04
Python Version:  Python 3.9.1

--
components: Library (Lib)
messages: 386768
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: < test.support > check_free_after_iterating( ) causes core dump in 
handling iteration.
type: crash
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Yang Feng


Yang Feng  added the comment:

Could you please tell me your secret method of getting the minimal script?
I will try to provide minimal ones in our following work.

--

___
Python tracker 
<https://bugs.python.org/issue43185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35323] Windows x86 executable installer can't install

2018-11-26 Thread liang feng


New submission from liang feng <[email protected]>:

see log

--
files: Python 3.7.1 (32-bit)_20181127100820.log
messages: 330486
nosy: outofthink
priority: normal
severity: normal
status: open
title: Windows x86 executable installer can't install
versions: Python 3.7
Added file: https://bugs.python.org/file47950/Python 3.7.1 
(32-bit)_20181127100820.log

___
Python tracker 
<https://bugs.python.org/issue35323>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35323] Windows x86 executable installer can't install

2018-11-26 Thread liang feng


liang feng <[email protected]> added the comment:

the file didn't download complete,change other computer download, it's fine

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue35323>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26457] Error in ipaddress.address_exclude function

2016-02-28 Thread feng liang

New submission from feng liang:

when i read in document 3.5.1,run the example in ipaddress.address_exclude 
function 

>>> n1 = ip_network('192.0.2.0/28')
>>> n2 = ip_network('192.0.2.1/32')
>>> list(n1.address_exclude(n2))  

I got:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python 3.5\lib\ipaddress.py", line 794, in address_exclude
s1, s2 = s1.subnets()
ValueError: not enough values to unpack (expected 2, got 1)

--
components: Library (Lib)
messages: 260994
nosy: out
priority: normal
severity: normal
status: open
title: Error in ipaddress.address_exclude function
type: behavior
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue26457>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27089] I think this is a small bug in urlparse.py

2016-05-23 Thread Feng A

New submission from Feng A:

=
BUG:

run : urlparse.urlparse('http://google.com]')
then: raise ValueError("Invalid IPv6 URL")

=
SOURCE:

if url[:2] == '//':

netloc, url = _splitnetloc(url, 2)

if (('[' in netloc and ']' not in netloc) or

(']' in netloc and '[' not in netloc)):

raise ValueError("Invalid IPv6 URL")

=
SOLUTION:

I THINK IT IS BETTER TO JUST REMOVE THE LAST 3 LINES ABOVE

--
components: Library (Lib)
messages: 266125
nosy: Feng A
priority: normal
severity: normal
status: open
title: I think this is a small bug in urlparse.py
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker 
<http://bugs.python.org/issue27089>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27089] I think this is a small bug in urlparse.py

2016-05-23 Thread Feng A

Feng A added the comment:

I wish you could think twice if you hadn't use urlparse.py in practical 
project.  

1. Do you like the module to raise an exception?
2. The href in webpage is always standard format?
3. Should the parse module verify the ipv6 url format? If so, did the module 
really make it?

4. Personally, Given a wrong formated url, It is the responsibility of the 
module to correct it ?

--

___
Python tracker 
<http://bugs.python.org/issue27089>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com