This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Creating a ctypes array of an element with size zero causes "Fatal Python error: Floating point exception"
Type: crash Stage: resolved
Components: ctypes Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Eric Wieser, ZackerySpytz, malin, skrah
Priority: normal Keywords: patch

Created on 2019-06-07 06:41 by Eric Wieser, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13881 merged Eric.Wieser, 2019-06-07 06:48
PR 13882 merged miss-islington, 2019-06-07 08:15
PR 13906 merged Eric.Wieser, 2019-06-08 01:48
PR 13911 merged miss-islington, 2019-06-08 09:24
Messages (7)
msg344901 - (view) Author: Eric Wieser (Eric Wieser) Date: 2019-06-07 06:41
Introduced in the fix to bpo-36504, GH-12660.

```python
>>> (ctypes.c_uint8 * 0 * 2)()
Fatal Python error: Floating point exception

>>> struct Empty(ctypes.Structure): _fields_ = []
>>> (Empty * 2)()
Fatal Python error: Floating point exception
```

This used to work just fine
msg344907 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-06-07 08:13
New changeset 0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54 by Stefan Krah (Eric Wieser) in branch 'master':
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13881)
https://github.com/python/cpython/commit/0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54
msg344908 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-06-07 08:34
New changeset 8f0bbbdcae73f275faff90cc4559f6111116f001 by Stefan Krah (Miss Islington (bot)) in branch '3.7':
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (GH-13881) (#13882)
https://github.com/python/cpython/commit/8f0bbbdcae73f275faff90cc4559f6111116f001
msg344917 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-06-07 09:51
Thanks for the fix!

3.7/3.8 are done, 2.7 still needs a manual backport.
msg345024 - (view) Author: Ma Lin (malin) * Date: 2019-06-08 07:30
> 3.7/3.8 are done

3.7 and master (3.9) are done, 3.8 was missed.
msg345025 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-06-08 09:19
New changeset 48f190f79cd89f7ad4409b3c782e462368583309 by Stefan Krah (Eric Wieser) in branch '2.7':
[2.7] bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13906)
https://github.com/python/cpython/commit/48f190f79cd89f7ad4409b3c782e462368583309
msg345026 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-06-08 09:46
New changeset 3d03a35ba0f162a350898100efc95fdf392070a2 by Stefan Krah (Miss Islington (bot)) in branch '3.8':
[3.8] bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13911)
https://github.com/python/cpython/commit/3d03a35ba0f162a350898100efc95fdf392070a2
History
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81369
2019-06-08 09:56:26skrahsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-08 09:46:58skrahsetmessages: + msg345026
2019-06-08 09:24:49miss-islingtonsetpull_requests: + pull_request13784
2019-06-08 09:19:36skrahsetmessages: + msg345025
2019-06-08 07:30:48malinsetnosy: + malin
messages: + msg345024
2019-06-08 01:48:22Eric.Wiesersetstage: backport needed -> patch review
pull_requests: + pull_request13779
2019-06-07 09:51:40skrahsetstage: patch review -> backport needed
2019-06-07 09:51:22skrahsetmessages: + msg344917
versions: - Python 3.7, Python 3.8
2019-06-07 08:34:19skrahsetmessages: + msg344908
2019-06-07 08:15:10miss-islingtonsetpull_requests: + pull_request13760
2019-06-07 08:13:57skrahsetnosy: + skrah
messages: + msg344907
2019-06-07 06:51:01Eric Wiesersetcomponents: + ctypes
2019-06-07 06:48:35Eric.Wiesersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13759
2019-06-07 06:41:34Eric Wiesercreate