mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-04 00:14:45 +01:00
Fixes for capnp 1.0 (#1)
* add capnp_api.h to gitignore * Change type of read_min_bytes from size to int Not sure why this was not causing issues before or if that is the right fix ... but it seems to be fine :) * Adapt python_requires to >=3.8 This was overlooked when 3.7 was deprecated. The ci no longer works with python 3.7 and cibuildwheel uses python_requires ... * Replace deprecated find_module with find_spec (importlib) find_module was deprecated with python 3.4 and python 3.12 removed it (https://docs.python.org/3.12/whatsnew/3.12.html#importlib). The new command is find_spec and only required a few adaptions
This commit is contained in:
parent
313d0d4c6d
commit
bb15822850
5 changed files with 13 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -46,6 +46,7 @@ docs/_build
|
||||||
|
|
||||||
capnp/lib/capnp.cpp
|
capnp/lib/capnp.cpp
|
||||||
capnp/lib/capnp.h
|
capnp/lib/capnp.h
|
||||||
|
capnp/lib/capnp_api.h
|
||||||
bundled/
|
bundled/
|
||||||
example
|
example
|
||||||
*.iml
|
*.iml
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## v2.0.0b1 (2023-10-03)
|
## v2.0.0b1 (2023-10-03)
|
||||||
- Update to bundled capnproto-1.0.1
|
- Update to bundled capnproto-1.0.1
|
||||||
- Remove explicit support for Python 3.7 (though wheels are still built for now)
|
- Remove support for Python 3.7
|
||||||
- Use custom build backend to support build args (#328)
|
- Use custom build backend to support build args (#328)
|
||||||
- Update Cython version and Python to 3.12 (#320)
|
- Update Cython version and Python to 3.12 (#320)
|
||||||
- Wrap all capnp code in a context-manager to avoid segfaults (#317)
|
- Wrap all capnp code in a context-manager to avoid segfaults (#317)
|
||||||
|
|
|
@ -42,6 +42,7 @@ from types import ModuleType as _ModuleType
|
||||||
from operator import attrgetter as _attrgetter
|
from operator import attrgetter as _attrgetter
|
||||||
from functools import partial as _partial
|
from functools import partial as _partial
|
||||||
from contextlib import asynccontextmanager as _asynccontextmanager
|
from contextlib import asynccontextmanager as _asynccontextmanager
|
||||||
|
from importlib.machinery import ModuleSpec
|
||||||
|
|
||||||
_CAPNP_VERSION_MAJOR = capnp.CAPNP_VERSION_MAJOR
|
_CAPNP_VERSION_MAJOR = capnp.CAPNP_VERSION_MAJOR
|
||||||
_CAPNP_VERSION_MINOR = capnp.CAPNP_VERSION_MINOR
|
_CAPNP_VERSION_MINOR = capnp.CAPNP_VERSION_MINOR
|
||||||
|
@ -2423,7 +2424,7 @@ cdef class _PyAsyncIoStreamProtocol(DummyBaseClass, asyncio.BufferedProtocol):
|
||||||
|
|
||||||
# State for reading data from the transport
|
# State for reading data from the transport
|
||||||
cdef char* read_buffer
|
cdef char* read_buffer
|
||||||
cdef size_t read_min_bytes
|
cdef int32_t read_min_bytes
|
||||||
cdef size_t read_max_bytes
|
cdef size_t read_max_bytes
|
||||||
cdef size_t read_already_read
|
cdef size_t read_already_read
|
||||||
cdef PromiseFulfiller[size_t]* read_fulfiller
|
cdef PromiseFulfiller[size_t]* read_fulfiller
|
||||||
|
@ -4322,7 +4323,7 @@ class _Importer:
|
||||||
self.extension = '.capnp'
|
self.extension = '.capnp'
|
||||||
self.additional_paths = additional_paths
|
self.additional_paths = additional_paths
|
||||||
|
|
||||||
def find_module(self, fullname, package_path=None):
|
def find_spec(self, fullname, package_path, target=None):
|
||||||
if fullname in _sys.modules: # Don't allow re-imports
|
if fullname in _sys.modules: # Don't allow re-imports
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -4363,12 +4364,12 @@ class _Importer:
|
||||||
path = abspath(path)
|
path = abspath(path)
|
||||||
|
|
||||||
if is_file(path+sep+capnp_module_name):
|
if is_file(path+sep+capnp_module_name):
|
||||||
return _Loader(fullname, join_path(path, capnp_module_name), self.additional_paths)
|
return ModuleSpec(fullname, _Loader(fullname, join_path(path, capnp_module_name), self.additional_paths))
|
||||||
if has_underscores:
|
if has_underscores:
|
||||||
if is_file(path+sep+capnp_module_name_dashes):
|
if is_file(path+sep+capnp_module_name_dashes):
|
||||||
return _Loader(fullname, join_path(path, capnp_module_name_dashes), self.additional_paths)
|
return ModuleSpec(fullname, _Loader(fullname, join_path(path, capnp_module_name_dashes), self.additional_paths))
|
||||||
if is_file(path+sep+capnp_module_name_spaces):
|
if is_file(path+sep+capnp_module_name_spaces):
|
||||||
return _Loader(fullname, join_path(path, capnp_module_name_spaces), self.additional_paths)
|
return ModuleSpec(fullname, _Loader(fullname, join_path(path, capnp_module_name_spaces), self.additional_paths))
|
||||||
|
|
||||||
|
|
||||||
_importer = None
|
_importer = None
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -210,7 +210,7 @@ extensions = [
|
||||||
]
|
]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
python_requires=">=3.7",
|
python_requires=">=3.8",
|
||||||
name="pycapnp",
|
name="pycapnp",
|
||||||
packages=["capnp"],
|
packages=["capnp"],
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
|
|
|
@ -144,6 +144,7 @@ async def test_load_capnp(foo):
|
||||||
baz_.text = "test"
|
baz_.text = "test"
|
||||||
baz_.qux.id = 2
|
baz_.qux.id = 2
|
||||||
|
|
||||||
wrapper = foo.Wrapper._new_client(Wrapper())
|
async with capnp.kj_loop():
|
||||||
remote = wrapper.wrapped(baz_)
|
wrapper = foo.Wrapper._new_client(Wrapper())
|
||||||
await remote
|
remote = wrapper.wrapped(baz_)
|
||||||
|
await remote
|
||||||
|
|
Loading…
Add table
Reference in a new issue