Skip to content

[BUG] Access violation under Windows in test_chrono_system_clock_roundtrip_time #2601

Open
@ghost

Description

Issue description

Test case test_chrono_system_clock_roundtrip_time from test_chrono.py fails with access violation (null pointer dereference) when passing instances of datetime.time to m.test_chrono2()

datetime2 = m.test_chrono2(time1)

Steps to reproduce

Build the project and run unit tests.

> mkdir build
> cd build
> cmake -G 'Visual Studio 15 2017' -A x64 ..
> cmake --build . --config Debug -- /m
> cmake --build . --config Debug --target check
...
  ..\..\tests\test_async.py ..                                             [  0%]
  ..\..\tests\test_builtin_casters.py ....s........s..                     [  5%]
  ..\..\tests\test_call_policies.py ........                               [  7%]
  ..\..\tests\test_callbacks.py .........                                  [ 10%]
  Windows fatal exception: access violation

  Current thread 0x00004fa8 (most recent call first):
    File "C:\Users\dorozhkin\Scratch\pybind11\tests\test_chrono.py", line 104 in test_chrono_system_clock_roundtrip_time

Behaviour is observed with 2.6.0.rc2 under Windows (VS2017/VS2019 compilers and Python 3.7 and 3.8 have been tested).

Removing all variants of datetime.time(..) parameters https://github.com/pybind/pybind11/blob/2e31e466dc7591612b4b17300797d352e1f3f801/tests/test_chrono.py#L85..L91 makes all tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions