omlish-cext 0.0.0.dev512__tar.gz → 0.0.0.dev513__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omlish-cext
3
- Version: 0.0.0.dev512
3
+ Version: 0.0.0.dev513
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License-Expression: BSD-3-Clause
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Python: >=3.13
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: omlish==0.0.0.dev512
17
+ Requires-Dist: omlish==0.0.0.dev513
18
18
  Dynamic: license-file
19
19
 
20
20
  # Overview
@@ -70,14 +70,17 @@ public:
70
70
  operator T*() const = delete;
71
71
  };
72
72
 
73
- // Helper struct to track unique typed values during processing
74
- struct UniqueInfo {
75
- PyObject *unique_tv_cls; // The unique class (borrowed from map key)
76
- PyObject *tv; // The typed value (borrowed from args)
77
- size_t idx; // Index in unique_lst when added
73
+ //
74
+
75
+ template<typename F>
76
+ struct ScopeGuard {
77
+ F cleanup;
78
+ ~ScopeGuard() { cleanup(); }
78
79
  };
79
80
 
80
- using TmpItem = std::variant<PyObject*, std::unique_ptr<UniqueInfo>>;
81
+ template<typename F> ScopeGuard(F) -> ScopeGuard<F>;
82
+
83
+ //
81
84
 
82
85
  PyDoc_STRVAR(init_typed_values_collection_doc,
83
86
  "init_typed_values_collection(*tvs, override=False, check_type=None)\n"
@@ -143,6 +146,15 @@ static PyObject * init_typed_values_collection(PyObject *module, PyObject *const
143
146
  return PyTuple_Pack(3, empty_tuple.get(), empty_dict.get(), empty_dict2.get());
144
147
  }
145
148
 
149
+ // Helper struct to track unique typed values during processing
150
+ struct UniqueInfo {
151
+ PyObject *unique_tv_cls; // The unique class (borrowed from map key)
152
+ PyObject *tv; // The typed value (borrowed from args)
153
+ size_t idx; // Index in unique_lst when added
154
+ };
155
+
156
+ using TmpItem = std::variant<PyObject*, std::unique_ptr<UniqueInfo>>;
157
+
146
158
  // Temporary storage
147
159
  std::vector<TmpItem> tmp_lst;
148
160
  tmp_lst.reserve(nargs);
@@ -150,10 +162,11 @@ static PyObject * init_typed_values_collection(PyObject *module, PyObject *const
150
162
  // Map from unique type to list of typed values
151
163
  std::unordered_map<PyObject*, std::vector<PyObject*>> unique_dct;
152
164
 
153
- struct UniqueKeysCleaner {
154
- std::unordered_map<PyObject*, std::vector<PyObject*>> &map;
155
- ~UniqueKeysCleaner() { for (auto &pair : map) Py_DECREF(pair.first); }
156
- } keys_cleaner{unique_dct};
165
+ ScopeGuard keys_cleaner{[&unique_dct] {
166
+ for (auto const& [key, _] : unique_dct) {
167
+ Py_DECREF(key);
168
+ }
169
+ }};
157
170
 
158
171
  // Process each typed value
159
172
  for (Py_ssize_t i = 0; i < nargs; i++) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omlish-cext
3
- Version: 0.0.0.dev512
3
+ Version: 0.0.0.dev513
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License-Expression: BSD-3-Clause
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Python: >=3.13
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: omlish==0.0.0.dev512
17
+ Requires-Dist: omlish==0.0.0.dev513
18
18
  Dynamic: license-file
19
19
 
20
20
  # Overview
@@ -0,0 +1 @@
1
+ omlish==0.0.0.dev513
@@ -13,7 +13,7 @@ urls = {source = 'https://github.com/wrmsr/omlish'}
13
13
  license = 'BSD-3-Clause'
14
14
  readme = 'README.md'
15
15
  requires-python = '>=3.13'
16
- version = '0.0.0.dev512'
16
+ version = '0.0.0.dev513'
17
17
  classifiers = [
18
18
  'Development Status :: 2 - Pre-Alpha',
19
19
  'Intended Audience :: Developers',
@@ -24,7 +24,7 @@ classifiers = [
24
24
  ]
25
25
  description = 'omlish'
26
26
  dependencies = [
27
- 'omlish == 0.0.0.dev512',
27
+ 'omlish == 0.0.0.dev513',
28
28
  ]
29
29
 
30
30
  [tool.setuptools]
@@ -1 +0,0 @@
1
- omlish==0.0.0.dev512