A small pie filled with pumpkin, sold on the Hogwarts Express sweet trolley. Harry shares some with Ron on their first trip to Hogwarts (PS6).
Miranda Goshawk writes in the Book of Spells that some students use the Hardening Charm to play tricks on other students, such turning a pumpkin pasty to the consistency of stone just before someone bites into it (BoS).
"pasty" = from Old French paste "dough, pastry," from Latin *pastata "meat wrapped in pastry" from Latin pasta
Pasties are small half-circle pies containing various fillings, popular in Britain. A pasty filled with beef, potatoes and some type of turnip is the national dish of Cornwall.