[issue38099] __dict__ attribute is incorrectly stated to be read-only
New submission from Reed : The documentation in this section (https://docs.python.org/3/library/stdtypes.html#special-attributes) states that the __dict__ attribute, and several others, are read-only. In particular, it states: "The implementation adds a few special read-only attributes to several object types, where they are relevant." Then it lists several attributes, including __dict__. However, __dict__ is writable. For example: class A: pass A().__dict__ = {'x': 1} Most other listed attributes, such as __class__ and __name__, are writable as well. They should not be documented as read-only. (Also, I'm not sure why the documentation lists object.__dict__ and instance.__class__. What is the difference between an object and an instance?) -- assignee: docs@python components: Documentation messages: 351765 nosy: docs@python, reed priority: normal severity: normal status: open title: __dict__ attribute is incorrectly stated to be read-only type: enhancement versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue38099> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38099] __dict__ attribute is incorrectly stated to be read-only
Reed added the comment: Thank you for the clarification. I didn't realize the section only referred to types, but it makes sense now that I read the documentation more carefully. The documentation is still incorrect for certain attributes (e.g. __bases__ and __name__) as they can be mutated. For example: class A: pass A.__name__ = 'AA' class B(A): pass class C(B): pass C.__bases__ = (A,) Also, this documentation is incorrectly linked to by other parts of the documentation. For example, in https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy, there is the sentence: "Special attributes: __dict__ is the attribute dictionary; __class__ is the instance’s class." __dict__ and __class__ link to the documentation about types, and yet that sentence is referring to all instances of any class (such as `A()`), not just type objects (such as `A`). In terms of concrete improves, I would suggest: * Adding a section somewhere describing __dict__ and __class__ for all instances, not just types. Or change the original section to refer to all instances. Assuming the original section is not changed to refer to all instances: * In the sentence "The implementation adds a few special read-only attributes to several object types", replace "object types" with "types" or "instances whose class subclasses from `type`" * Replace `instance.class` with `class.class`. The phrase `instance` is confusing, as it then describes `class.__bases__`, which does explicitly use the word "class" to indicate it only applies to classes. -- ___ Python tracker <https://bugs.python.org/issue38099> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array
New submission from Reed : If a float32 Numpy array is passed to statistics.variance(), an assertion failure occurs. For example: import statistics import numpy as np x = np.array([1, 2], dtype=np.float32) statistics.variance(x) The assertion error is: assert T == U and count == count2 Even if you convert x to a list with `x = list(x)`, the issue still occurs. The issue is caused by the following lines in statistics.py (https://github.com/python/cpython/blob/ec007cb43faf5f33d06efbc28152c7fdcb2edb9c/Lib/statistics.py#L687-L691): T, total, count = _sum((x-c)**2 for x in data) # The following sum should mathematically equal zero, but due to rounding # error may not. U, total2, count2 = _sum((x-c) for x in data) assert T == U and count == count2 When a float32 Numpy value is squared in the term (x-c)**2, it turns into a float64 value, causing the `T == U` assertion to fail. I think the best way to fix this would be to replace (x-c)**2 with (x-c)*(x-c). This fix would no longer assume the input's ** operator returns the same type. -- components: Library (Lib) messages: 359323 nosy: reed priority: normal severity: normal status: open title: Assertion failure when calling statistics.variance() on a float32 Numpy array type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue39218> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array
Reed added the comment: Thank you all for the comments! Either using (x-c)*(x-c), or removing the assertion and changing the final line to `return (U, total)`, seem reasonable. I slightly prefer the latter case, due to Mark's comments about x*x being faster and simpler than x**2. But I am not an expert on this. > I am inclined to have the stdev of float32 return a float32 is possible. What > do you think? Agreed. > OTOH, (x-c)*(x-c) repeats the subtraction unnecessarily, but perhaps > assignment expressions could rescue us? Yeah, we should avoid repeating the subtraction. Another method of doing so is to define a square function. For example: def square(y): return y*y sum(square(x-c) for x in data) > Would that also imply intermediate calculations being performed only with > float32, or would intermediate calculations be performed with a more precise > type? Currently, statistics.py computes sums in infinite precision (https://github.com/python/cpython/blob/422ed16fb846eec0b5b2a4eb3a978c9862615665/Lib/statistics.py#L123) for any type. The multiplications (and exponents if we go that route) would still be float32. -- ___ Python tracker <https://bugs.python.org/issue39218> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3862] test_array fails on FreeBSD7 amd64
New submission from Reed O'Brien <[EMAIL PROTECTED]>: or in FreeBSD? 2.6rc1 and 3.0b3 both fail test_array on FreeBSD7 amd64 test_array passes in 2.5.2 on the same machine but fails test_list the same as test_array... *** Signal 9 -- components: Tests messages: 73204 nosy: robrien severity: normal status: open title: test_array fails on FreeBSD7 amd64 type: crash versions: Python 2.5, Python 2.6, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3862> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3862] test_array fails on FreeBSD7 amd64
Reed O'Brien <[EMAIL PROTECTED]> added the comment: 2.6rc2 and Python-3.0b3 test_array detail test_alloc_overflow (test.test_array.DoubleTest) ... Killed Fills swap space and dumps core. 2.5.2 test_list test_addmul (test.test_list.ListTest) ... ok test_append (test.test_list.ListTest) ... ok Killed The FreeBSD ports patches fix this in 2.5.2. Specifically patching seq_tests.py to limit test_bigrepeat() to if sys.maxint <= 2147483647. no other tests fail; so I don't know immediately what else is patched. Although there are about 25 patches for the 2.5 port. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3862> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39598] ERR_CACHE_MISS
New submission from Thomas Reed : Hi, I have problem with cache. If there is someone in the detail of product longer that 5 minutes and than click to button "back",it makes error "ERR_CACHE_MISS". Do you know, how can i solve it? Thank you :) -- components: Windows messages: 361683 nosy: judiction, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: ERR_CACHE_MISS ___ Python tracker <https://bugs.python.org/issue39598> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39598] ERR_CACHE_MISS
Thomas Reed added the comment: No, normally browsing the web and products (without login in), after looking at the product details and then clicking the back button, the error will occur. -- ___ Python tracker <https://bugs.python.org/issue39598> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39598] ERR_CACHE_MISS
Thomas Reed added the comment: Alright, thanks. -- ___ Python tracker <https://bugs.python.org/issue39598> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43201] sqlite3 import * ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
New submission from Tyler Reed : Running on a new, updated Windows 10 machine with no virtual environment. After removing all previous Python installations, rebooting and performing a fresh install if Python 3.9.1. I run the python console and type: import sqlite3 I receive the following error: Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python39\lib\sqlite3\__init__.py", line 23, in from sqlite3.dbapi2 import * File "C:\Program Files\Python39\lib\sqlite3\dbapi2.py", line 27, in from _sqlite3 import * ImportError: DLL load failed while importing _sqlite3: The specified module could not be found. I verified that the sqlite3.dll file does exist in C:\Program Files\Python39\DLLs -- messages: 386832 nosy: ZenSkunkworx priority: normal severity: normal status: open title: sqlite3 import * ImportError: DLL load failed while importing _sqlite3: The specified module could not be found. type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43201> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43201] sqlite3 import * ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
Tyler Reed added the comment: It was an environment issue. There were pre-existing files (pyd and pyc) in the application folder (from builds done with Kivy) and apparently python was loading those instead of the libraries in the python39 folder. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue43201> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19491] Python Crashing When Saving Documents
New submission from Carolyn Reed: The ICT teacher at the school I work at has reported that frequently students are experiencing their Python software crashing when they attempt to save files. No error message is reported, the software just freezes. They are using the IDLE GUI Python v 3.2.4 on Windows 7 Professional 32-bit. Please advise. -- components: IDLE messages: 202103 nosy: carolyn.r...@talktalk.net priority: normal severity: normal status: open title: Python Crashing When Saving Documents type: crash versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue19491> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19491] Python Crashing When Saving Documents
Carolyn Reed added the comment: Unfortunately we are unable to run it from the command line - as we are a school this is locked down for students. There are no error messages at all, the program just freezes. -- ___ Python tracker <http://bugs.python.org/issue19491> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19491] Python Crashing When Saving Documents
Carolyn Reed added the comment: Okay, we'll see if we can go to V 3.3.2 and see what difference this makes. -- ___ Python tracker <http://bugs.python.org/issue19491> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19491] Python Crashing When Saving Documents
Carolyn Reed added the comment: There doesn't seem to be a Pygame version for 3.3 on the pygame webpage? -- ___ Python tracker <http://bugs.python.org/issue19491> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1544102] ctypes unit test fails (test_macholib.py) under MacOS 10.4.7
Reed O'Brien added the comment: I am no longer using OSX 10.4.x, but this issue appears fixed in 2.5.4 and 2.6.1 on OSX 10.5.6 I have no reason for this to stay open -- nosy: +robrien ___ Python tracker <http://bugs.python.org/issue1544102> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26725] list() destroys map object data
New submission from Steven Reed: Example repro: Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x=map(bool,[1,0,0,1,1,0]) >>> x >>> list(x) [True, False, False, True, True, False] >>> list(x) [] >>> x -- components: Library (Lib) messages: 263111 nosy: Steven Reed priority: normal severity: normal status: open title: list() destroys map object data type: behavior versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue26725> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com