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

Binary file
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,13 +1,25 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: selectolax
3
- Version: 0.3.29
3
+ Version: 0.3.30
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:
9
+ MIT License
10
+
11
+ Copyright (c) 2018-2025, Artem Golubin
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
+
19
+ Project-URL: Repository, https://github.com/rushter/selectolax
20
+ Project-URL: Documentation, https://selectolax.readthedocs.io/en/latest/parser.html
21
+ Project-URL: Changelog, https://github.com/rushter/selectolax/blob/main/CHANGES.rst
22
+ Keywords: selectolax,html,parser,css,fast
11
23
  Classifier: Development Status :: 5 - Production/Stable
12
24
  Classifier: Topic :: Text Processing :: Markup :: HTML
13
25
  Classifier: Topic :: Internet
@@ -16,27 +28,18 @@ Classifier: Intended Audience :: Developers
16
28
  Classifier: License :: OSI Approved :: MIT License
17
29
  Classifier: Natural Language :: English
18
30
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
31
  Classifier: Programming Language :: Python :: 3.9
22
32
  Classifier: Programming Language :: Python :: 3.10
23
33
  Classifier: Programming Language :: Python :: 3.11
24
34
  Classifier: Programming Language :: Python :: 3.12
25
35
  Classifier: Programming Language :: Python :: 3.13
36
+ Requires-Python: >=3.9
37
+ Description-Content-Type: text/x-rst
26
38
  License-File: LICENSE
27
- Provides-Extra: cython
28
- Requires-Dist: Cython==3.0.11; extra == "cython"
39
+ Requires-Dist: Cython==3.0.11
29
40
  Dynamic: author
30
- Dynamic: author-email
31
- Dynamic: classifier
32
- Dynamic: description
33
41
  Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license
36
42
  Dynamic: license-file
37
- Dynamic: project-url
38
- Dynamic: provides-extra
39
- Dynamic: summary
40
43
 
41
44
  .. image:: docs/logo.png
42
45
  :alt: selectolax logo
@@ -0,0 +1,26 @@
1
+ selectolax/__init__.py,sha256=QXGDeB8i55GmKcd_UXLaBjnqN76hPlaDFhHSTBgQwEc,185
2
+ selectolax/base.pxi,sha256=zOj3BrCA71xd-mJFtkMIAglP4ZybfrHVoCoy6ljTBDQ,93
3
+ selectolax/lexbor.c,sha256=t2OJwP7pIHYq-Ry6qHIIvivpAsJN4E-08FVdNmer5gU,2373583
4
+ selectolax/lexbor.cp311-win_amd64.pyd,sha256=sVy8zBYOdKTTJA-TLVOebp57s12B4LCEeXRVrMYxDXI,3189760
5
+ selectolax/lexbor.pxd,sha256=1d9nvZd9rZl27gwPwVV5BlbR2LAi6jDK69Xm9Guz5Kk,21538
6
+ selectolax/lexbor.pyi,sha256=BZSChBeL9ctyJk3IICpHyzmbFytD8sYvr4v3hSG7iIk,6877
7
+ selectolax/lexbor.pyx,sha256=-O-g03mLCQKc9F19eMvo3PyoLDtF09IIuFziXJAl6Ao,11520
8
+ selectolax/parser.c,sha256=pok6ajFRnMk_QBj0cFkvNk4C_jt7gGTbbqHoJ2j8yHk,2237176
9
+ selectolax/parser.cp311-win_amd64.pyd,sha256=DU0TEY68GxndbRCKvndtRfUglIwnAaZpn8YDglAdf9M,2143744
10
+ selectolax/parser.pxd,sha256=4pM_CcZlvJlaR8EMjZCnSmnCcJbwcYOldRTBEbfwm48,25145
11
+ selectolax/parser.pyi,sha256=jFQa0_av9w9HT4XtbJioI86Le0N_Wvbc7BFbdPqDuHM,11598
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=r9DroDAkoxIvSMiDTRKpfYp503b7yUteDoYwglhQ0FM,3241
16
+ selectolax/lexbor/node.pxi,sha256=aLt7VzOvVErdkafncXR8LSwPBdODACh00kBtoaBBSQM,30736
17
+ selectolax/lexbor/selection.pxi,sha256=irSqUr6-csI3RNQMv11FNGd__GX1VjVmVhB7aSmj8Wg,6951
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.30.dist-info/licenses/LICENSE,sha256=A7Jb3WZcENcLfZRc7QPdm9zJdwfpIyPodPJu-kdMH6E,1087
23
+ selectolax-0.3.30.dist-info/METADATA,sha256=QPFdZ2KqmowrwhCaOA9B49GIKqpHzAEW6ObesnXTvZw,7582
24
+ selectolax-0.3.30.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
25
+ selectolax-0.3.30.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
26
+ selectolax-0.3.30.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,,