GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow reentrant ctypes OUT construction (#9620) · RustPython/RustPython@d691ac6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • crates/vm/src/stdlib/_ctypes
    • function.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎crates/vm/src/stdlib/_ctypes/function.rs‎

Copy file name to clipboardExpand all lines: crates/vm/src/stdlib/_ctypes/function.rs
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,11 +1312,12 @@ fn get_buffer_addr(obj: &PyObject) -> Option<usize> {
13121312
/// Create OUT buffer for a parameter type
13131313
fn create_out_buffer(arg_type: &Py<PyType>, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
13141314
// For POINTER(T) types, create T instance (the pointed-to type)
1315-
if arg_type.fast_issubclass(PyCPointer::static_type())
1316-
&& let Some(stg_info) = arg_type.stg_info_opt()
1317-
&& let Some(ref proto) = stg_info.proto
1318-
{
1319-
return proto.as_object().call((), vm);
1315+
if arg_type.fast_issubclass(PyCPointer::static_type()) {
1316+
// Constructing the pointed-to type can re-enter pointer type setup.
1317+
let proto = arg_type.stg_info_opt().and_then(|info| info.proto.clone());
1318+
if let Some(proto) = proto {
1319+
return proto.as_object().call((), vm);
1320+
}
13201321
}
13211322
// Not a pointer type or no proto, create instance directly
13221323
arg_type.as_object().call((), vm)

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.