Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/sqlite3/md5func.py @ 39042:c02fa187e0f4 legacy-trunk
Part of SF patch #1484695. This removes dead code. The chksum was
already verified in .frombuf() on the lines above. If there was
a problem an exception is raised, so there was no way this condition
could have been true.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 10 Jul 2006 00:23:17 +0000 |
| parents | 204ec383b445 |
| children |
| rev | line source |
|---|---|
|
38197
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
1 import sqlite3 |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
2 import md5 |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
3 |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
4 def md5sum(t): |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
5 return md5.md5(t).hexdigest() |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
6 |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
7 con = sqlite3.connect(":memory:") |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
8 con.create_function("md5", 1, md5sum) |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
9 cur = con.cursor() |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
10 cur.execute("select md5(?)", ("foo",)) |
|
204ec383b445
Text files missing the SVN eol-style property.
Tim Peters <tim.peters@gmail.com>
parents:
38069
diff
changeset
|
11 print cur.fetchone()[0] |
