code-intelligence 4.1.0__py3-none-win_amd64.whl → 4.2.2__py3-none-win_amd64.whl

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.
@@ -13,7 +13,7 @@ from .goober import (
13
13
  # SHAME - Bump when fixing things too embarrassing to admit.
14
14
  # PROUD.DEFAULT.SHAME
15
15
  # \ | /
16
- __version__ = "4.1.0"
16
+ __version__ = "4.2.2"
17
17
  __version_info__ = tuple(int(i) for i in __version__.split('.'))
18
18
 
19
19
  __all__ = [
@@ -1,8 +1,8 @@
1
- import ctypes as C
2
1
  import os
3
2
  import sys
4
3
  import time
5
4
  import platform
5
+ import ctypes as C
6
6
  from pathlib import Path
7
7
  from dataclasses import dataclass, fields
8
8
  from enum import IntEnum, IntFlag
@@ -73,41 +73,39 @@ class Definition_Link:
73
73
  column_0_based : int = 0
74
74
 
75
75
 
76
+ # Using ["..."] syntax to create a copy independant of
77
+ # whether any other library sets the signature for those functions.
78
+ Py_IncRef = C.pythonapi["Py_IncRef"]
79
+ Py_IncRef.argtypes = [C.py_object]
80
+ Py_IncRef.restype = None
81
+
82
+ Py_DecRef = C.pythonapi["Py_DecRef"]
83
+ Py_DecRef.argtypes = [C.py_object]
84
+ Py_DecRef.restype = None
85
+
86
+
76
87
  # IMPORTANT: KEEP THIS ALIVE FOR GO THREAD WORKER
77
88
  C_NO_CALLBACK = SCAN_CALLBACK(0)
78
- _KEEPALIVE = dict[int, tuple]()
79
89
 
80
90
 
81
91
  def _wrap_data_ptr(tup: tuple):
82
- ptr = id(tup)
83
- _KEEPALIVE[ptr] = tup
84
- return ptr
92
+ # MANUALLY INCREMENT THE REFERENCE COUNT
93
+ # We are now responsible for its lifetime
94
+ Py_IncRef(C.py_object(tup))
85
95
 
96
+ return id(tup)
86
97
 
87
- def _unwrap_data_ptr(ptr) -> tuple:
88
- tup = _KEEPALIVE.pop(ptr, None)
89
- assert tup is not None, "keepalive missing for callback"
90
- return tup
91
98
 
99
+ def _unwrap_data_ptr(data_ptr) -> tuple:
100
+ assert data_ptr, "Received a NULL pointer"
101
+
102
+ tup = C.cast(data_ptr, C.py_object).value
92
103
 
93
- # def _wrap_data_ptr(tup: tuple):
94
- # # MANUALLY INCREMENT THE REFERENCE COUNT
95
- # # We are now responsible for its lifetime
96
- # C.pythonapi.Py_IncRef(C.py_object(tup))
97
- #
98
- # return id(tup) # C.cast(obj, C.c_void_p)
99
- #
100
- #
101
- # def _unwrap_data_ptr(data_ptr) -> tuple:
102
- # assert data_ptr != 0, "we got NULL"
103
- #
104
- # tup = C.cast(data_ptr, C.py_object).value
105
- #
106
- # # MANUALLY DECREMENT THE REFERENCE COUNT.
107
- # # We are fulfilling our promise
108
- # C.pythonapi.Py_DecRef(C.py_object(tup))
109
- #
110
- # return tup
104
+ # MANUALLY DECREMENT THE REFERENCE COUNT.
105
+ # We are fulfilling our promise
106
+ Py_DecRef(C.py_object(tup))
107
+
108
+ return tup
111
109
 
112
110
 
113
111
  def scan_file(file, language: Language, callback=None, data=None) -> bool:
Binary file
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code_intelligence
3
- Version: 4.1.0
3
+ Version: 4.2.2
4
4
  Summary: Code intelligence library
@@ -0,0 +1,6 @@
1
+ code_intelligence-4.2.2.dist-info/METADATA,sha256=rZXF32YBKPTTroc4vgTxereZWlDOjz0VV5k42b0iKT4,100
2
+ code_intelligence-4.2.2.dist-info/RECORD,,
3
+ code_intelligence-4.2.2.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
4
+ code_intelligence/__init__.py,sha256=nQPGzPpVtVdbEkTI2dGXmBdEXm8x0Q0_KbDhz-IiB80,587
5
+ code_intelligence/goober.py,sha256=sb8NcJDfvHlJj7mXuAQpZ7apOtpQtg-7Ra5BrBZhwc4,6801
6
+ code_intelligence/libcode_intelligence.so,sha256=bSSY32V9sln7FrntGw2iD_DO_xO5VbdXLq1wz5WKvrA,8276992
@@ -1,6 +0,0 @@
1
- code_intelligence-4.1.0.dist-info/METADATA,sha256=6DKHGSuEngNhrMD9G7MsHadhQ7ZgLxOMYHnUqL3mlHI,100
2
- code_intelligence-4.1.0.dist-info/RECORD,,
3
- code_intelligence-4.1.0.dist-info/WHEEL,sha256=aD7J6E7Slys9i0J65v6Ehfi0DHYa5rImRhUDp62Iwh0,98
4
- code_intelligence/__init__.py,sha256=GretMovZ4RmKTY2m0I8AojQAx9XerdPF9Tv3llt6jIA,587
5
- code_intelligence/goober.py,sha256=47frHnf6SH0HiMqlrAOnWf45RUjgg8EpQU4dW4Dl5p8,6831
6
- code_intelligence/libcode_intelligence.so,sha256=4MONSnTgqkXqib40ngp6202oiq8hGW10NgJxhVhxSNs,8276992