[issue37241] Item Count Error in Shelf

2019-06-13 Thread Jesse Bacon


Change by Jesse Bacon :


--
resolution:  -> third party

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-13 Thread Jesse Bacon


Jesse Bacon  added the comment:

I was using anaconda distribution on OSX.  It failed for 3.6 and 3.7.  I pulled 
off anaconda and compiled from source and the script executed correctly 
regardless of whether or not "--enable-optimizations" was set.  Anaconda claims 
to be geared towards scientists so this is alarming.  Thank you for your time.

--

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-12 Thread Jesse Bacon


Jesse Bacon  added the comment:

Eric,

The interpreter said something about passing a negative value when I converted 
the db.keys to a list.  I have attached a script in txt format and a Jupyter 
notebook for further analysis.  I apologize for posting images,  I just saw 
your note.  I'll go ahead and look at the shelve source while you determine if 
this information is sufficient. Thank you for your time.

--

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-12 Thread Jesse Bacon


Change by Jesse Bacon :


Added file: https://bugs.python.org/file48415/pbr37241_Jesse_Bacon.py.txt

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-12 Thread Jesse Bacon


Change by Jesse Bacon :


Added file: https://bugs.python.org/file48414/Python Proof.ipynb

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-12 Thread Jesse Bacon


Change by Jesse Bacon :


Added file: https://bugs.python.org/file48413/ShelfKeys.png

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-12 Thread Jesse Bacon


Jesse Bacon  added the comment:

I am missing keys, when extracting the data back out with todays NVD pull.
---
KeyError  Traceback (most recent call last)
~/anaconda3/lib/python3.6/shelve.py in __getitem__(self, key)
110 try:
--> 111 value = self.cache[key]
112 except KeyError:

KeyError: 'CVE-2019-1842'

During handling of the above exception, another exception occurred:

KeyError  Traceback (most recent call last)
 in 
  1 results = []
  2 for x in raw_cves:
> 3 results.append(db[x])

~/anaconda3/lib/python3.6/shelve.py in __getitem__(self, key)
111 value = self.cache[key]
112 except KeyError:
--> 113 f = BytesIO(self.dict[key.encode(self.keyencoding)])
114 value = Unpickler(f).load()
115 if self.writeback:

KeyError: b'CVE-2019-1842'

--

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37241] Item Count Error in Shelf

2019-06-11 Thread Jesse Bacon


New submission from Jesse Bacon :

I have loaded the National Vulnerability Database from NIST for 2019 and it 
includes 3989 JSON Documents.  This data I have placed in a shelf.  when I run 
len(db.keys()) I get 3658.  len(set(cves)) == 3989 : True

When I extract the data from the shelf I have the right amount of records, 
3989.  I tested on python 3.7.3 and Python 3.6.5.  I am concerned this is going 
to ruin a metric in a security report.  For example, A risk exposure report may 
use the number of keys in a yearly vulnerability db as the baseline for a risk 
calculation which contrasts the number of patched CVE's.  

nvdcve-1.0-2019.json

--
components: Library (Lib)
files: KeyCount.png
messages: 345290
nosy: jessembacon
priority: normal
severity: normal
status: open
title: Item Count Error in Shelf
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file48411/KeyCount.png

___
Python tracker 
<https://bugs.python.org/issue37241>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-03 Thread Jesse Bacon

New submission from Jesse Bacon:

https://docs.python.org/2/tutorial/stdlib2.html
Section 11.6. Weak References

The example code below from the python tutorial suggests that the value of a is 
no persistent when cast into a WeakValueDictionary as entry 'primary'

The value persisted in the dictionary aver 'a' was deleted and garbage 
collection had been called.  I did not see a bug report for this already 
forgive me if there was one already put in.  

import weakref, gc
class A:
def __init__(self, value):
self.value = value
def __repr__(self):
return str(self.value)

a = A(10)   # create a reference
d = weakref.WeakValueDictionary()
d['primary'] = a# does not create a reference
d['primary']# fetch the object if it is still alive

del a   # remove the one reference
gc.collect()# run garbage collection right away

d['primary']# entry was automatically removed

--
components: Demos and Tools
messages: 242534
nosy: jessembacon
priority: normal
severity: normal
status: open
title: Python 2.7 Tutorial Conflicting behavior  with WeakValueDictionary.
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24123
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-03 Thread Jesse Bacon

Jesse Bacon added the comment:

https://docs.python.org/2/tutorial/stdlib2.html
Section 11.6. Weak References

The example code below from the python tutorial suggests that the value of 'a' 
is not persistent when cast into a WeakValueDictionary as entry 'primary'

The value persisted in the dictionary aver 'a' was deleted and garbage 
collection had been called.  I did not see a bug report for this already 
forgive me if there was one already put in.  

import weakref, gc
class A:
def __init__(self, value):
self.value = value
def __repr__(self):
return str(self.value)

a = A(10)   # create a reference
d = weakref.WeakValueDictionary()
d['primary'] = a# does not create a reference
d['primary']# fetch the object if it is still alive

del a   # remove the one reference
gc.collect()# run garbage collection right away

d['primary']# entry was automatically removed

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24123
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-03 Thread Jesse Bacon

Jesse Bacon added the comment:

https://docs.python.org/2/tutorial/stdlib2.html
Section 11.6. Weak References

The example code below from the python tutorial suggests that the value of 'a' 
is not persistent when cast into a WeakValueDictionary as entry 'primary'

The value persisted in the dictionary after 'a' was deleted and garbage 
collection had been called.  I did not see a bug report for this already 
forgive me if there was one already put in.  

import weakref, gc
class A:
def __init__(self, value):
self.value = value
def __repr__(self):
return str(self.value)

a = A(10)   # create a reference
d = weakref.WeakValueDictionary()
d['primary'] = a# does not create a reference
d['primary']# fetch the object if it is still alive

del a   # remove the one reference
gc.collect()# run garbage collection right away

d['primary']# entry was automatically removed

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24123
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-03 Thread Jesse Bacon

Jesse Bacon added the comment:

Thank you for the second eyes. 
I just verified that it works using the standard python shell.  It looks like 
the bug is in IPython.  I’ll post it there.

In [7]: class A:
   ...: def __init__(self, value):
   ...: self.value = value
   ...: def __repr__(self):
   ...: return str(self.value)
   ...: 

In [8]: a = A(10)

In [9]: d = weakref.WeakValueDictionary()

In [10]: d['primary'] = a

In [11]: d['primary'] 
Out[11]: 10

In [12]: del a

In [13]: gc.collect()
Out[13]: 148

In [14]: d['primary']
Out[14]: 10

In [15]: 

sincerely,

Jesse Bacon

 On May 3, 2015, at 8:54 PM, R. David Murray rep...@bugs.python.org wrote:
 
 
 R. David Murray added the comment:
 
 If I run the example code you pasted using 2.7, I get a KeyError.  So the 
 example looks correct to me.
 
 --
 nosy: +r.david.murray
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue24123
 ___

--
title: Python 2.7 Tutorial Conflicting behavior  with WeakValueDictionary. - 
Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24123
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-03 Thread Jesse Bacon

Jesse Bacon added the comment:

After further testing it appears that the bug is in IPython not Python 2.7. 
The bug has been moved to the Python list at 
https://github.com/ipython/ipython/issues/8403#issuecomment-98565759

--
resolution:  - third party
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24123
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com