selectolax 0.3.29__cp311-cp311-win_amd64.whl → 0.3.31__cp311-cp311-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.

Potentially problematic release.


This version of selectolax might be problematic. Click here for more details.

selectolax/parser.pyx CHANGED
@@ -124,7 +124,7 @@ cdef class HTMLParser:
124
124
  status = myhtml_parse(self.html_tree, self._encoding, html, html_len)
125
125
 
126
126
  if status != 0:
127
- raise RuntimeError("Can't parse HTML:\n%s" % str(html))
127
+ raise RuntimeError("Can't parse HTML (status code: %d)" % status)
128
128
 
129
129
  assert self.html_tree.node_html != NULL
130
130
 
@@ -147,9 +147,13 @@ cdef class HTMLParser:
147
147
  def root(self):
148
148
  """Returns root node."""
149
149
  if self.html_tree and self.html_tree.node_html:
150
- node = Node()
151
- node._init(self.html_tree.node_html, self)
152
- return node
150
+ try:
151
+ node = Node()
152
+ node._init(self.html_tree.node_html, self)
153
+ return node
154
+ except Exception:
155
+ # If Node creation or initialization fails, return None
156
+ return None
153
157
  return None
154
158
 
155
159
  @property
@@ -185,6 +189,12 @@ cdef class HTMLParser:
185
189
  name : str (e.g. div)
186
190
 
187
191
  """
192
+ # Validate tag name
193
+ if not name:
194
+ raise ValueError("Tag name cannot be empty")
195
+ if len(name) > 100: # Reasonable limit for tag names
196
+ raise ValueError("Tag name is too long")
197
+
188
198
  cdef myhtml_collection_t* collection = NULL
189
199
  pybyte_name = name.encode('UTF-8')
190
200
  cdef mystatus_t status = 0;
@@ -428,6 +438,7 @@ cdef class HTMLParser:
428
438
  if self.html_tree != NULL:
429
439
  myhtml = self.html_tree.myhtml
430
440
  myhtml_tree_destroy(self.html_tree)
441
+ self.html_tree = NULL # Prevent double-free
431
442
  if myhtml != NULL:
432
443
  myhtml_destroy(myhtml)
433
444
 
@@ -1,42 +1,35 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: selectolax
3
- Version: 0.3.29
3
+ Version: 0.3.31
4
4
  Summary: Fast HTML5 parser with CSS selectors.
5
5
  Home-page: https://github.com/rushter/selectolax
6
6
  Author: Artem Golubin
7
- Author-email: me@rushter.com
8
- License: MIT license
9
- Project-URL: Source code, https://github.com/rushter/selectolax
10
- Keywords: selectolax
7
+ Author-email: Artem Golubin <me@rushter.com>
8
+ License: MIT
9
+ Project-URL: Repository, https://github.com/rushter/selectolax
10
+ Project-URL: Documentation, https://selectolax.readthedocs.io/en/latest/parser.html
11
+ Project-URL: Changelog, https://github.com/rushter/selectolax/blob/main/CHANGES.rst
12
+ Keywords: selectolax,html,parser,css,fast
11
13
  Classifier: Development Status :: 5 - Production/Stable
12
14
  Classifier: Topic :: Text Processing :: Markup :: HTML
13
15
  Classifier: Topic :: Internet
14
16
  Classifier: Topic :: Internet :: WWW/HTTP
15
17
  Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
18
  Classifier: Natural Language :: English
18
19
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
20
  Classifier: Programming Language :: Python :: 3.9
22
21
  Classifier: Programming Language :: Python :: 3.10
23
22
  Classifier: Programming Language :: Python :: 3.11
24
23
  Classifier: Programming Language :: Python :: 3.12
25
24
  Classifier: Programming Language :: Python :: 3.13
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/x-rst
26
27
  License-File: LICENSE
27
28
  Provides-Extra: cython
28
- Requires-Dist: Cython==3.0.11; extra == "cython"
29
+ Requires-Dist: Cython; extra == "cython"
29
30
  Dynamic: author
30
- Dynamic: author-email
31
- Dynamic: classifier
32
- Dynamic: description
33
31
  Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license
36
32
  Dynamic: license-file
37
- Dynamic: project-url
38
- Dynamic: provides-extra
39
- Dynamic: summary
40
33
 
41
34
  .. image:: docs/logo.png
42
35
  :alt: selectolax logo
@@ -0,0 +1,26 @@
1
+ selectolax/__init__.py,sha256=FqcMB0_lRBSC5GjhhahFsX1piTpOGEj2Mr7MkrzFh1U,185
2
+ selectolax/base.pxi,sha256=zOj3BrCA71xd-mJFtkMIAglP4ZybfrHVoCoy6ljTBDQ,93
3
+ selectolax/lexbor.c,sha256=rvkQp6ZbkbXMmMBAZXNY8U8UBD41YbE60kwHji94CSk,2419967
4
+ selectolax/lexbor.cp311-win_amd64.pyd,sha256=n4CecPb5IsPtNec2PcUZn9Os209RtAwL1q-eLfFS3zs,3144192
5
+ selectolax/lexbor.pxd,sha256=cG264E-tFNOFTy0k5bAqV_sZnz4G6a4a21WEhqTL-NI,21516
6
+ selectolax/lexbor.pyi,sha256=bDXv_EKVBKLGyweo7vpxg-yxNKa_mRo_K2hK9LMsxIQ,25200
7
+ selectolax/lexbor.pyx,sha256=-O-g03mLCQKc9F19eMvo3PyoLDtF09IIuFziXJAl6Ao,11520
8
+ selectolax/parser.c,sha256=xGQmCxrEmyQCi9I11d3py7cIcFumqhhVpdystsQ1dp0,2287084
9
+ selectolax/parser.cp311-win_amd64.pyd,sha256=td8dNyI3SeaGuvjk5eMN8AIeOxOPKrug2l_5-dXlet8,2109440
10
+ selectolax/parser.pxd,sha256=4pM_CcZlvJlaR8EMjZCnSmnCcJbwcYOldRTBEbfwm48,25145
11
+ selectolax/parser.pyi,sha256=5Czf63278MQC01IxY-CHzoDyTS1oHiYRD2OxEscyL1o,25584
12
+ selectolax/parser.pyx,sha256=bS2n70o_5OPJ6JuXTBAVUTc-XhxqC4DXzPE4H3-e5Ek,13987
13
+ selectolax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ selectolax/utils.pxi,sha256=4rtdRcLWuemxN1qe7Eul5jvAmHZ65r7Gvf67_Wg8Bt4,3566
15
+ selectolax/lexbor/attrs.pxi,sha256=KvQaCo0jM3Bva6_xG3TGzkCVFjNQ4kgTxWO95gsGbkw,4007
16
+ selectolax/lexbor/node.pxi,sha256=BuJIYcTUucvHUP4w2wl90uBwjcqpv1vRyt4No2O_Quo,30921
17
+ selectolax/lexbor/selection.pxi,sha256=4I8cjYMjC2Gz7xLrYWrl7jbnwDoVmab-GvrJKiTALTI,7017
18
+ selectolax/lexbor/util.pxi,sha256=0I4ElWIwXxrZCfMmGCtyDU127oMsPCqC3IcUk4QmMAc,582
19
+ selectolax/modest/node.pxi,sha256=Da2b3cdmggCX736x0htGvac51SEeGCcY5l-LA5H4HNI,34376
20
+ selectolax/modest/selection.pxi,sha256=0elY7JwnpPVaw0QZE1T7A78s9FIph5uWIhwy4sEXGU8,6586
21
+ selectolax/modest/util.pxi,sha256=o2nPGGGtRlLqOCa7yPk94CfBzNlVr7ull7osFy6NRX4,570
22
+ selectolax-0.3.31.dist-info/licenses/LICENSE,sha256=A7Jb3WZcENcLfZRc7QPdm9zJdwfpIyPodPJu-kdMH6E,1087
23
+ selectolax-0.3.31.dist-info/METADATA,sha256=4WhsMNLtWvjn-th6KxIHAy7iEpBPvB-a3LFyqLxeJjk,6401
24
+ selectolax-0.3.31.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
25
+ selectolax-0.3.31.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
26
+ selectolax-0.3.31.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-win_amd64
5
5
 
@@ -1,26 +0,0 @@
1
- selectolax/__init__.py,sha256=EJMTWQiycBDUJq3c6zs6gPVxNbcNCHfynjXd42bZWeA,185
2
- selectolax/base.pxi,sha256=zOj3BrCA71xd-mJFtkMIAglP4ZybfrHVoCoy6ljTBDQ,93
3
- selectolax/lexbor.c,sha256=QBMO8PscLH9WEB4Lr9NL7gxmT4SPlq2pyOG4B4cK4ck,2368851
4
- selectolax/lexbor.cp311-win_amd64.pyd,sha256=MLhjXAV5yzZt_dqapkKeIOmH7TtK_v74ZNuog1u8V5M,3200000
5
- selectolax/lexbor.pxd,sha256=1d9nvZd9rZl27gwPwVV5BlbR2LAi6jDK69Xm9Guz5Kk,21538
6
- selectolax/lexbor.pyi,sha256=IeGh8NEcvybAHWxgh_-rHV9oxKjkdeWb9QUtgjBH12M,6782
7
- selectolax/lexbor.pyx,sha256=6nvezEKHO5ffieso6jr0vYss8V0WkVup9NocJoVepuo,11353
8
- selectolax/parser.c,sha256=9FirqHRzfMS3U67DKJk0YJ5x7HdEqOpmFAQnJskv_MM,2224906
9
- selectolax/parser.cp311-win_amd64.pyd,sha256=t1rpsIJ8pHZmSEw_R4wTqFG6L26x5EMy1W1b2V_S14Q,2143232
10
- selectolax/parser.pxd,sha256=4pM_CcZlvJlaR8EMjZCnSmnCcJbwcYOldRTBEbfwm48,25145
11
- selectolax/parser.pyi,sha256=jFQa0_av9w9HT4XtbJioI86Le0N_Wvbc7BFbdPqDuHM,11598
12
- selectolax/parser.pyx,sha256=CeZDNHF6G1RhUv2TfihZmCVMkGUwMhy6zrsffB1p7hE,13528
13
- selectolax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- selectolax/utils.pxi,sha256=4rtdRcLWuemxN1qe7Eul5jvAmHZ65r7Gvf67_Wg8Bt4,3566
15
- selectolax/lexbor/attrs.pxi,sha256=r9DroDAkoxIvSMiDTRKpfYp503b7yUteDoYwglhQ0FM,3241
16
- selectolax/lexbor/node.pxi,sha256=Kr5Oi3eQdxplTt8ltG1eWjFfHFrdcgsm5YYJnKFJDK8,30763
17
- selectolax/lexbor/selection.pxi,sha256=DVtVnaCwzXPPkDqgW0vEtkQa1zWJ0c2Ud3KGSrvK5PM,6755
18
- selectolax/lexbor/util.pxi,sha256=0I4ElWIwXxrZCfMmGCtyDU127oMsPCqC3IcUk4QmMAc,582
19
- selectolax/modest/node.pxi,sha256=FP2_09dUKxK-z-j_A9hw98WwvBZFGvtifA2YYKbKpbU,34300
20
- selectolax/modest/selection.pxi,sha256=0elY7JwnpPVaw0QZE1T7A78s9FIph5uWIhwy4sEXGU8,6586
21
- selectolax/modest/util.pxi,sha256=o2nPGGGtRlLqOCa7yPk94CfBzNlVr7ull7osFy6NRX4,570
22
- selectolax-0.3.29.dist-info/licenses/LICENSE,sha256=A7Jb3WZcENcLfZRc7QPdm9zJdwfpIyPodPJu-kdMH6E,1087
23
- selectolax-0.3.29.dist-info/METADATA,sha256=wwLeEm4lfcwdZ58hApe0sxokMPTPsk4rnO16d2tPZBU,6471
24
- selectolax-0.3.29.dist-info/WHEEL,sha256=ge07nwgZNrHM7F-h6ntB4NDhu5ar8XLYRt0vb6q09YM,101
25
- selectolax-0.3.29.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
26
- selectolax-0.3.29.dist-info/RECORD,,